Automatically update an instance property based on value from a sibling instance property

What is the problem? There is an answer in the binding editor (on the bottom) and there is one in the fieldAnswer property.

Note that you have not itnitialised Package. If you don't get a match for machine == Equipment then you will have an error.

Tip: post the code as well as the picture of code so we can test it and edit it. Format it with the </> button.

the probelem is the output in tag binding editor in scripting i got value of GTS . then the field answer not responding simultaneously . i need to apply 1st the code. i want is to if the output in script it reflect in the field answer in instances.

	productLine = ''
	rowcount = value.getRowCount()
	Equipment = self.props.instances[0].fieldAnswer
	for i in range(rowcount):
		machine = value.getValueAt(i,1)
		if machine == Equipment:
			Package = value.getValueAt(i,0)
	return Package

^Fix this first. The binding preview might be hiding this error and showing the last valid value. I don't particularly trust the preview value.

You shouldn't be using a script transform when you can just have an expression binding:

lookup(
	{[Default]Preferences/MCACC/Settings/Product Line},
	{this.props.instances[0].fieldAnswer},
	"",
	1,
	0
)

This is much more performant than a script transform and has a fallback value.

If you are worried about an indirect tag binding, make a custom property on the table and then point the first item in the lookup statement to that instead:

lookup(
	{this.custom.indirectTagBindingValue},
	{this.props.instances[0].fieldAnswer},
	"",
	1,
	0
)
2 Likes

Agreed.
Here's a link to the Expression Language lookup() documentation.