Nested UDT Reference within Tag Reference in Expression Tags

Hi Everyone,

New Ignition user, for doing UDT references within Tag references within expression tags. How do you format it? I read the UDT parameters part of 8.1 manual but don't really understand how to apply this to what I want to do.

Attempted Expression (Tag Reference with UDT TankName nested within): {[~]Tanks/{TankName}/FLOW}

Any help would be appreciated, thanks!

This is one of the rare cases where you need to use the tag() expression function, since you cannot nest brace-delimited parameters within other curly-brace references.

( Do NOT use the tag() function in user-interface bindings. )

Thank you so much! I appreciate the help!

Can you show me how this works?

Tried the following and all didn't work.

tag("[default]Tanks/%s/FLOW" % {TankName})
tag("[default]Tanks/{TankName}/FLOW")
toFloat(tag("[default]Tanks/{TankName}/FLOW"))

The Tag Expression binding tag() function is expecting a string, the resultant string should be a tag path which is bound to.
From within the binding, if you pick a tag using the 'Browse Tags' picker, you'll see curly braces around that tag. Change the curly braces to double quotes, then start making that tag path dynamic.
Let's say you want to bind to the following tag (as entered in the Tag Expression binding):
tag("[Provider]Path/To/Tag")

Now, let's assume there is a tag (or property) that contains the VALUE matching some of those paths:
[Provider]Some/Other/Path/To/Tag.value == "Path"

Then, the original path can be updated to concatenate the binding dynamically:
tag("[Provider]" + {[Provider]Some/Other/Path/To/Tag} + "/To/Tag")

The VALUE of the tag in the { } will appear in the string concatenation, and then Ignition will bind to that resultant tag path.

Note that if the provider is omitted entirely (e.g. "Path/To/Tag"), then the default provider of the project is used for the binding 'this provider' is used (same as [~])..

Edit: I misread the original post. Updated to more closely reflect tag() function usage within an expression tag, not an Expression Tag binding within a project as assumed.

This worked, thank you so much!

For future people: This is what the end product was: tag("[~]Tanks/" + {TankName} + "/FLOW")

1 Like