I am trying to modify the history graph you’ve made. Mostly it is a simplified version following your original plan.
I have a container cntDatasets with 7 checkboxes, each label representing a different series in the graph. Each series corresponds to a different dataset. I use the code below to determine if the checkboxes are checked, and if so to build a query, then use that query to populate a dataset on the graph.
root = fpmi.gui.getParentWindow(event).rootContainer
chart = root.getComponent(“Chart”)
Tank = event.source.parent.getComponent(“lblTank”).text
checkboxes = root.getComponent(“cntDatasets”).components
selectedCheckboxes = [cb for cb in checkboxes if cb.selected]
if len(selectedCheckboxes) > 0:
for cbNum in range(len(selectedCheckboxes)):
checkbox = selectedCheckboxes[cbNum]
query = “exec dbo.usp_TankHistory '” + Tank + “’,’” + checkbox.name + “’”
This bonks on line 12, which is the “chart.setDatasetEnabled…” line.
This is, by the way, one line that I don’t understand: the second argument in this line according to the docs should be a bit value turning on or off the enabled property, but in your code from the goodie it appears to be something else. Can you explain this please?
The debug window shows:
exec dbo.usp_TankHistory ‘999’,‘Level’
which means it is recognizing all 7 checkboxes as being checked, but is not iterating through and building a query string past the first checkbox.
Any advice is appreciated. D. Lewis