Use tags metadata field value in another field

Wondering, is it possible to use a tags metadata field value in another metadata field?
As an example, in the tooltip or description fields write something like “The actual position in {EngUnits}” where EngUnits is whatever engineering unit currently specified for the tag?

Yes you can,

You’d need a script for it as it doesn’t seem like you can write expressions directly into those properties.

The way I looked at it was a Tag Event script under Value Changed - this is probably overkill as it’ll run the script every time the value changes, but at least if somehow the string inside Tooltip was accidentally removed, it’d just put it back there on the next value change.

Here’s the script:

tagPath1 = tagPath+".EngUnit"
tagPath2 = tagPath+".Tooltip"
tag=system.tag.read(tagPath1)
tooltip = "The actual position in "+tag.value
system.tag.write(tagPath2,tooltip)

Say the EngUnit was °C, the script would place “The actual position in °C” in the Tooltip of the tag.

Obviously you can substitute “.Tooltip” with “.Description” if you want

Thank you, seems to be more complex than what I had hoped though. Had hoped for some simple solution within the tag editor itself.

The best way is probably to use an UDT where you define parameters. F.e. myUnit

Then you can refer from EngUnit to that parameter by using {myUnit} there. And you can also use it in the tooltip string.

That is what I ended up doing.