Ignition 7.9 Dropdown - Selected Value From Column X

Hi - Newbie to Ignition (apologies) coming from a WinCC/FactoryTalk background and used to VBScript etc.

I’ve got a dropdown control ‘cboRecipe’ which I’ve populated in ‘table’ form from an SQL query - all good it pulls back 16 columns worth of data in the drop down…I don’t want the user to see all of the columns so I’ve hidden all but the first three. I’ve got an OK button on the screen and I’m trying to do a script from that button which will give me the selected value of the dropdown from one of the hidden columns (they are all strings) - lets say column number 5 (which is called ‘ProgramName’).

I can do the following but it doesn’t get me the value from column number 5 obviously: -

selRow = event.source.parent.getComponent(‘cboRecipe’).selectedStringValue
system.gui.messageBox("Selected Value: " + str(selRow))

Any help would be much appreciated while I get to grips with Python…


Welcome! (And Happy New Year!)

I generally use bindings for this. Add custom string properties to the dropdown component for each column you need. Use an expression binding like this:

try({Root Container.cboRecipe.data}[{Root Component.Container.selectedIndex},'columnName'], 'fallback value')

Bindings are faster than python and are immediately available for use in other bindings.

{ Also, you might get teased by grumpy greybeards for using Hungarian notation in Java/Jython environments… :sweat_smile: }

Happy New Year and thanks for answering…it’s not working though.

I added the custom string property ‘ProgramName’ so all good there but when I add the expression binding to it (replacing ‘columnName’ with ‘ProgramName’) I get the following error: -

Invalid tag path: ‘Root Component.cboRecipe’. com.google.common.collect.ComputationException: com.inductiveautomation.ignition.common.sqltags.parser.TagPathFormatException: Tag property ‘cboRecipe’ is not a valid property.

When I try and select properties from the editor button it seems to replace ‘Component’ with ‘Container’ so I tried it both ways and get the same error message. Also there doesn’t seem to be a selectedRow property in the choose property box… there’s a ‘Selected Index’ but that doesn’t work either.

I’m in Ignition 7.9.18 if that makes a difference…

P.S it took long enough to knock hungarian notation into me so I doubt it’ll get beaten out of me…I’ll take what’s coming…


Yeah, typo. Should have been Root Container. And there should have been a .data. Edited above.

Fantastic !! - Works brilliantly…got to get this project done this week so no doubt there’ll be loads more questions (onto converting SQL things in next few days).

Thanks again for your help.