I am just trying to display the selected item of a dropdown, the dropdown is being populated by a sql query. Right now there are two item in the dropdown, test1 and test 2.
I have the property change of the dropdown populated with “print event.source.selectedItem”
When i click between test1 and test2 the selectedItem gets printed three times on the screen and im not sure why?
My goal is to run a query of the selected item after it has been selected but i need to understand how it functions first, thanks!
The propertyChange event is triggered for every property that changes on a component. When you select a value, you are changing the selectedIndex, selectedValue, and selectedLabel at a minimum. You should use the event.propertyName property to limit when your changes are made:
if event.propertyName == "selectedIndex":
#do something
That helps, I’m sure, but there’s an easier way to do what you want, I think. If you want to update a table query based on the selection, you only have to include a reference to the dropdown value in your query for the table:
table.data:
SELECT columns
FROM tablename
WHERE fieldname = '{Root Container.Dropdown.selectedStringValue}'
Ignition will immediately refresh the table query when the value changes.
[quote=“drewdin”]
so i take it that since three items change that is why when i select an item it shows up three times? Thanks again[/quote]
Yes, that is correct.
I don’t think there is any list availabe for “property change events”. You need to run “print event.propertyName” and modify the values of properties and see which ones get printed.