Click to Graph refresh

I am using a modified version of your click to graph goodie. When pens are added to the graph, the screen will not show the added pens unless the chart property “Pens” is set to Poll at some rate. Can this be accomplished with pen polling set to off? I just need the chart to refresh its pens once on an add event.

Yep, you just need to use the “fpmi.db.refresh” function to force a refresh of a polling-off query binding.

Does this need to be in the global script that adds the pens or the chart configuration “Pens” sql query?

Global script

adds a PointID (data point) to graph

def addGraphPoint(pid):
import fpmi
cid = fpmi.system.getClientId()
fpmi.db.runUpdateQuery(“insert into ctg_active_client (pointID, client_ID) values(’%s’,’%s’)”%(pid,cid), “IADemo”)

#------------

deletes a PointID (data point) from a graph

def deleteGraphPoint(pid):
import fpmi
cid = fpmi.system.getClientId()
fpmi.db.runUpdateQuery(“delete from ctg_active_client where pointID=’%s’ and client_ID=’%s’”%(pid,cid), “IADemo”)

Pens Query
SELECT p.*
FROM ctg_pens p join ctg_active_client c on p.PointID=c.PointID
where c.Client_ID = ‘{Root Container.Client_ID}’
order by p.table_name

No, it wouldn’t go there because those scripts tend to run on other windows, right?

I’m guessing that you don’t close the graph window (i.e. via a “swap”) in your normal course of navigation, otherwise you wouldn’t have this problem (polling off queries always run when a window is opened).

If this is the case, then you can put the refresh script on the graph window’s internalFrameActivated event - this will fire whenever the window is focused.

Ok,
I “ain’t gettin it” pardon the pun.

Here’s what I have:

pens = event.source.parent.getComponent(“Pens”)
fpmi.db.refresh(pens, “pollRate”)

Pens=Chart configuration “Pens”

Error=Traceback (innermost last):
File “event:internalFrameActivated”, line 11, in ?
TypeError: getComponent(): 1st arg can’t be coerced to int

Just a little more info on ths:
I have a pop-up window “pen edit” that pops up on top of the chart window from which you can “add” your pens to the chart. I just need the chart to populate with the polling set to off on “Pens” chart configuration.

Thanks for your patience and quick replies

I also tried this:

window = event.source.rootContainer.getComponent(“ctg_Chart”)
fpmi.db.refresh(window, “Pens”)

This does not give an error, however it seems to have no effect.

[quote=“cdmac73401”]I also tried this:

window = event.source.rootContainer.getComponent(“ctg_Chart”)
fpmi.db.refresh(window, “Pens”)

This does not give an error, however it seems to have no effect.[/quote]

I think you almost had it, except that “Pens” should be “pens” (its case-sensitive)

Worked perfect

Thanks Carl