Pie Chart Refresh

hello. I am trying to update a pie chart as the data in the database table changes and updates. I am currently getting this error:

10:20:54.057 [MainThread] WARN com.inductiveautomation.factorypmi.application.components.PMIPieChart - system.db.refresh() was unable to find a refresh-compatible property binding on Pie Chart.SELECT VLAN, COUNT(VLAN) AS VLAN_COUNT FROM FA_ECA_MASTER GROUP BY VLAN
10:20:54.058 [MainThread] WARN com.inductiveautomation.factorypmi.application.components.PMIPieChart - system.db.refresh() was unable to find a refresh-compatible property binding on Pie Chart 1.SELECT Unit, COUNT(Unit) AS UNIT_COUNT FROM FA_ECA_MASTER GROUP BY Unit
10:20:54.059 [MainThread] WARN com.inductiveautomation.factorypmi.application.components.PMIPieChart - system.db.refresh() was unable to find a refresh-compatible property binding on Pie Chart 2.SELECT VLAN, COUNT(VLAN) AS VLAN_COUNT FROM FA_ECA_MASTER GROUP BY VLAN

with this code:


system.db.refresh(system.gui.getParentWindow(event).getRootContainer().getComponent("Pie Chart"), "SELECT VLAN, COUNT(VLAN) AS VLAN_COUNT FROM FA_ECA_MASTER GROUP BY VLAN")

system.db.refresh(system.gui.getParentWindow(event).getRootContainer().getComponent("Pie Chart 1"), "SELECT Unit, COUNT(Unit) AS UNIT_COUNT FROM FA_ECA_MASTER GROUP BY Unit")

system.db.refresh(system.gui.getParentWindow(event).getRootContainer().getComponent("Pie Chart 2"), "SELECT VLAN, COUNT(VLAN) AS VLAN_COUNT FROM FA_ECA_MASTER GROUP BY VLAN")

Don’t provide the query string. Provide the scripting name of the property that has that query bound to it.

1 Like

That’s not how system.db.refresh works. You specify a component reference as the first argument, and then the actual property (which should already have a binding on it) as the second argument; something like:
system.db.refresh(event.rootContainer.getComponent("Pie Chart"), "data")
If you want to run specific queries and insert the results using a script, then look into the other system.db. scripting methods, such as runNamedQuery.

I was trying to do it without running a named query. Thank you.