How to read current dropdown value and bind the tag to it?


Very new to ignition working on my first project. I have dropdown list in perspective. I want to configure event on mouse click, that will read the current value selected on the dropdown list and write to the tag I want. But I dont know how to read the current dropdown value? Appreciated if I can get the correct syntax.


hello could you get something I have a similar situation

In Perspective the selected value of the dropdown will be stored in the properties of the dropdown, specifically in “props.value”. This will equal the value corresponding to the selected label in the dropdown options. In this screenshot the selected value is “2” as is the label of the option.

Within an event script, for example on a runAction button script, one can browse the properties of other components using the property selector on the right side of the scripting window. You can drill down into the view>root>dropdown>props>value to have the property browser complete the full property path for you. In the following screenshot that would be “self.getSibling(“Dropdown”).props.value” and I store it in a variable.

This question is a little ambiguous. If you only want to bind a tag to whatever the most recent selection in a dropdown is, then @kvane 's answer will probably work for you, but there are some things to consider:

  1. There could be multiple sessions writing to that tag, so what are you trying to gain from this? I recommend against using tags outside of controls unless you need a value which is shared across multiple sessions. The requests for help have not made it clear as to whether or not they need to use and write to the tag. If the value is specific to only this session, then you should use a session property instead of the tag.
  2. If you want the dropdown to display the value of the tag as well as write to it, then you should use a bidirectional tag binding.
    Screen Shot 2021-04-29 at 6.12.35 PM
  3. system.tag.write is deprecated, and we recommend use of the newer writeBlocking() function which expects a list of tag paths and a list of values.
system.tag.writeBlocking(["[default]DropdownTag"], [self.getSibling("Dropdown").props.value])
1 Like

hello @kvane and @cmallonee

I used a 2-State Toggle Botton and I have the next error

Error executing script for event: actionPerformed
on component: 2-State Toggle.

Traceback (most recent call last):
File “event:actionPerformed”, line 1, in
NameError: name ‘self’ is not defined

this is my button and my list


this is my tag

I need to use this tag for once considering the data selected from my list is saved in my database

Hello Antonio,

The responses earlier were specifically for the Perspective visualization module.

For your case in Vision you will have a property reference selector on the right side of that script editor. If you click through the property menu you can identify your Dropdown component and select the property you want to set the tag to.

It will look something like:

1 Like