Graph updates when Update from DB script evaluated only the first time.
Jul 6, 2017 3:25 PM(1572 views)
So I have a data table that is generated from an SQL query so it has the "Update from DB" script attached to it. I can run that script as often as I want using and it works for the data table without issue, pulling in new data from the server.
However my issue is I have an overlay chart with Automatic Recalc(1) on and that works the first time I run the Update from DB script, the new data instantly appears on the chart, but when I do it again, the chart no longer updates despite new data populating the table.
I found similar behavior for other platforms so anytime I can I draw visuals as part of the update query. Modifying the visual so JMP is forced to redraw it is works though, for example adding and then removing needles in an overlap plot gets it to update.
One script could draw the overlay plot:
//make a new overlay plot
myvis = Overlay Plot(
X( :time ),
Y( :value )
A second script refreshes the query (copied from the 'Update from DB' script, then adds and removes needles from the overlap plot:
//Refresh the data
Current Data Table() << Update From Database(
"DSN=OSI PI Archive",
"SELECT TOP 10000000 time, value FROM piarchive..piinterp
WHERE (tag IN ('Sinusoid'))
AND time BETWEEN '*-5m' AND '*' AND timestep = '10s'"
//Add and remove needles from overlay plot (or modify axis, point type, etc.)
myvis << Needle( state=1 );
myvis << Needle( state=0 );