I’m trying to dynamically fill a dropdown list. I have two drop down lists and I want to fill the 2nd list depending on the value of the 1st list. I selected a PropertyChange event handler for the first list so when the value changes, the script will run. I have a table that has dynamic properties (WCn) doing a lookup for data in the table. Here’s my code:dropdown = event.source.parent.getComponent("Dropdown WC")
table = event.source.parent.parent.getComponent('Table')
if dropdown.Row21 == 0 and table.WC21 == 1:
newRow = [21, " Workcenter 21"]
dropdown.data = system.dataset.deleteRow(dropdown.data,0)
dropdown.data = system.dataset.addRow(dropdown.data, 0, newRow)
event.source.parent.getComponent("Dropdown WC").Row21 = 1
if dropdown.Row21 == 1 and table.WC21 == 0:
event.source.parent.getComponent("Dropdown WC").Row21 = 1
I tried to use “UpdateRow”, but got a “3rd arg can’t be coerced to org.python.core.PyDictionary” error.
In a perfect world, I’d want an empty dataset containing 25 rows and when the property Table.WCn is “True”, I want to fill in data in row n. I really like the fact that even though the dataset contains 25 rows, the dropdown only displays the rows that contain data. That will work perfectly with what I’m trying to do. Eventually, I’ll want to populate the whole list, but I’m just working with item #21 right now. Is there an easy way to loop this from 0 to 100?
Thanks!