# Need Help Understanding a dropdown

**URL:** <https://forum.inductiveautomation.com/t/need-help-understanding-a-dropdown/7715>\
**Category:** Ignition\
**Created:** [December 16, 2013, 7:03pm UTC](https://forum.inductiveautomation.com/t/need-help-understanding-a-dropdown/7715 "2013-12-16T19:03:23Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![drewdin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/drewdin/32/3363_2.png) [@drewdin](https://forum.inductiveautomation.com/u/drewdin)\
**Post date:** [December 16, 2013, 7:03pm UTC](https://forum.inductiveautomation.com/t/need-help-understanding-a-dropdown/7715/1 "2013-12-16T19:03:23Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![adamaustin](https://avatars.discourse-cdn.com/v4/letter/a/5f8ce5/32.png) [@adamaustin](https://forum.inductiveautomation.com/u/adamaustin)\
**Post date:** [December 16, 2013, 7:33pm UTC](https://forum.inductiveautomation.com/t/need-help-understanding-a-dropdown/7715/2 "2013-12-16T19:33:13Z")

</div>

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:

```auto
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:

```auto
SELECT columns 
FROM tablename
WHERE fieldname = '{Root Container.Dropdown.selectedStringValue}'
```

Ignition will immediately refresh the table query when the value changes.

---

<div class="post-metadata">

**Author:** ![drewdin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/drewdin/32/3363_2.png) [@drewdin](https://forum.inductiveautomation.com/u/drewdin)\
**Post date:** [December 16, 2013, 7:36pm UTC](https://forum.inductiveautomation.com/t/need-help-understanding-a-dropdown/7715/3 "2013-12-16T19:36:48Z")

</div>

Thanks for the quick response, i actually want to run a separate query on a different table based on the value selected from the dropdown.

so i take it that since three items change that is why when i select an item it shows up three times? Thanks again

---

<div class="post-metadata">

**Author:** ![adamaustin](https://avatars.discourse-cdn.com/v4/letter/a/5f8ce5/32.png) [@adamaustin](https://forum.inductiveautomation.com/u/adamaustin)\
**Post date:** [December 16, 2013, 7:40pm UTC](https://forum.inductiveautomation.com/t/need-help-understanding-a-dropdown/7715/4 "2013-12-16T19:40:37Z")

</div>

You should play with the code. See what happens when you do:

```auto
print event.propertyName
```

---

<div class="post-metadata">

**Author:** ![drewdin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/drewdin/32/3363_2.png) [@drewdin](https://forum.inductiveautomation.com/u/drewdin)\
**Post date:** [December 16, 2013, 7:45pm UTC](https://forum.inductiveautomation.com/t/need-help-understanding-a-dropdown/7715/5 "2013-12-16T19:45:03Z")

</div>

i guess since i wasn’t filtering anything out i was seeing all changes, ill play around a little more later. Thanks for your help! I appreciate it

---

<div class="post-metadata">

**Author:** ![drewdin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/drewdin/32/3363_2.png) [@drewdin](https://forum.inductiveautomation.com/u/drewdin)\
**Post date:** [February 5, 2014, 9:43pm UTC](https://forum.inductiveautomation.com/t/need-help-understanding-a-dropdown/7715/6 "2014-02-05T21:43:04Z")

</div>

where can i get a list of all of the property change events associated with them? thanks

---

<div class="post-metadata">

**Author:** ![nmudge](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nmudge/32/3394_2.png) [@nmudge](https://forum.inductiveautomation.com/u/nmudge)\
**Post date:** [February 6, 2014, 3:18am UTC](https://forum.inductiveautomation.com/t/need-help-understanding-a-dropdown/7715/7 "2014-02-06T03:18:18Z")

</div>

[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.

---

<div class="post-metadata">

**Author:** ![nmudge](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nmudge/32/3394_2.png) [@nmudge](https://forum.inductiveautomation.com/u/nmudge)\
**Post date:** [February 6, 2014, 3:35am UTC](https://forum.inductiveautomation.com/t/need-help-understanding-a-dropdown/7715/8 "2014-02-06T03:35:24Z")

</div>

This from the Ignition Manual is helpful:

> [@](#):
>
> The propertyChange event is called any time a bindable property changes on a component. This includes all custom properties. This can be a very useful tool, allowing you to respond via scripting when a property changes. Because this one event handler is called for multiple properties, it is typical for a handler to first have to filter based on the propertyName, so that it is responding to a specific property changing.

[inductiveautomation.com/support/ ... \_types.htm](http://inductiveautomation.com/support/usermanuals/ignition/index.html?event_types.htm)

Best,  
Nick Mudge
