Vision input component binded to 2 tags

Hi,
Is it possible for the input component, for example “input text field” to be associated with the int1 and int2 tags depending on the state of the bool1 tag?
For example. I want my “input text field” to be able to read and write value from int1 if bool1 is true and from int2 if bool1 is false. I tried using this code which is working fo writing value:

var1 = system.gui.getParentWindow(event).getRootContainer().getComponent(‘Numeric Text Field 1’).value
bool1 = system.tag.readBlocking(["[Sample_Tags]Writeable/WriteableBoolean1"])[0].value

char = event.keyCode
if char == 10 and bool1 == 1:
system.tag.writeBlocking(["[Sample_Tags]Writeable/WriteableInt1"],[var1])
elif char == 10 and bool1 == 0:
system.tag.writeBlocking(["[Sample_Tags]Writeable/WriteableInt2"],[var1])

but i dont know what i need to change in this component in order to show correct value depending on bool1 value.

Use a custom string property to convert the boolean to “1” or “2”. Then use an indirect tag binding that substitutes that custom property into the tag path. Set the indirect binding to bidirectional.

1 Like