BOUND CONST scripting error

Hello! In vision, I am trying to write a script on the text property of a label which will take the tagPath (a custom property in this window which is a string) and look at the tag from that tagPath to determine what text should fill the label. For example, if the tagPath is ‘Z1/Z1P24’, I need the script to look at the ‘RDY’ (ready) and ‘RNG’ (running) boolean tags within Z1/Z1P24. If RDY is 1 and RNG is 0, the label should say “READY”, if they are both 1 it should say “RUNNING”, and if both are 0 it should say “NOT READY”. I have an error on line 1. I am still not super familiar with the Igition Syntax but here is what I have so far:

if {[default]event.source.parent.TagPath/RDY} == 1 AND {[default]event.source.parent.TagPath/RNG} == 0:
	{Root Container.Label.text} = "READY"
elif {[default]event.source.parent.TagPath/RDY} AND {[default]event.source.parent.TagPath/RNG} == 1:
	{Root Container.Label.text} = "RUNNING"
else:
	{Root Container.Label.text} = "NOT READY"

Any advice is appreciated!

To get a value from a tag, you have to read the tag which will give you a fully qualified value, meaning it will have the value, quality, and timestamp of the tag. To get just a value, it would be like this, (assuming v8 Ignition)

paths = ['[default]RDY','[default]RNG']
qVals = system.tag.readBlocking(paths)
rdy = qVals[0].value
rng = qVals[1].value

Instead, I would probably create an expression tag (string type) using your RDY and RNG tags then bind it to the label. Something like

if({[~]RDY} && !{[~]RNG}, 'READY', if({[~]RDY} && {[~]RNG}, 'RUNNING','NOT READY'))
1 Like