Expression Tag/Property Addressing

I’m trying to write a line of code that will change based on other tag values. I found in the user manual the expression “tag” in order to add string values to a tag address: tag("D"+{Root Container.Login Logout.Dropdown.selectedValue}) For this example, the user can change the value of the drop down and this component will either look at “D100” or “D324”, depending on the drop down value. Is there an easier/better way of doing this type of addressing w/o using the “tag” expression?

It sounds like the Indirect Tag Binding is what you’re looking for. With that, you define a tag path and parameters, such as “D{1}”. The parameters can then be bound to other properties, like your selected value. There’s a little information about this in the user manual, but I think if you just go to the component binding and select “Indirect”, you’ll see what I mean.

Hope this helps,

Yes, thank you. I would like to use this functionality in an expression, so I need to be able to type out the code. Here’s what I tried so far:if("D"+{Root Container...}+{/PB/Enable}=1,"True","False") where the property is an integer value. The software excepts the edits, but the component goes red, as if the tag doesn’t exist. I think my syntax is off just a bit.

Whenever you are using tag indirection in the expression language you have to use the tag function. Your expression should be:if(tag("D"+{Root Container...}+"/PB/Enable")=1,"True","False")

Great! Thank you very much!

Is there a way to “break up” a property? For example if I wanted to do something like this:if(tag("Root Container.Table.WC"+{Root Container.Login.Dropdown.Value})=21,1,0)where I’m trying to indirectly fill a property. Maybe not the tag expression? Something else? If nothing, how about a runScript expression?

Thank you!

Unfortunately, you cannot do that with properties right now. You can do it in a script but not in a runScript since it doesn’t have the event object. I will add a feature request in to have a property function like the tag function.

How do I do it in a script? I’ve tried this: event.source.parent.getCompnent('POI').SUB00%iPP %(x) == 1:, but I think this type of Python can only be used for Strings.

Well, if the property is a dynamic property you can do:event.source.parent.getComponent('POI').getPropertyValue("SUB00%iPP" % (x)) == 1