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

**URL:** <https://forum.inductiveautomation.com/t/automatically-update-an-instance-property-based-on-value-from-a-sibling-instance-property/86068>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [February 20, 2024, 11:59pm UTC](https://forum.inductiveautomation.com/t/automatically-update-an-instance-property-based-on-value-from-a-sibling-instance-property/86068 "2024-02-20T23:59:29Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jose\_Rodolfo\_Mutuc](https://avatars.discourse-cdn.com/v4/letter/j/e0b2c6/32.png) [@Jose\_Rodolfo\_Mutuc](https://forum.inductiveautomation.com/u/Jose_Rodolfo_Mutuc)\
**Post date:** [February 20, 2024, 11:59pm UTC](https://forum.inductiveautomation.com/t/automatically-update-an-instance-property-based-on-value-from-a-sibling-instance-property/86068/1 "2024-02-20T23:59:29Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/e/5e3f7f4402aa6690aa3d4a32ebe62e76801f6089.png)

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [February 21, 2024, 12:15am UTC](https://forum.inductiveautomation.com/t/automatically-update-an-instance-property-based-on-value-from-a-sibling-instance-property/86068/2 "2024-02-21T00:15:01Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Jose\_Rodolfo\_Mutuc](https://avatars.discourse-cdn.com/v4/letter/j/e0b2c6/32.png) [@Jose\_Rodolfo\_Mutuc](https://forum.inductiveautomation.com/u/Jose_Rodolfo_Mutuc)\
**Post date:** [February 21, 2024, 1:37am UTC](https://forum.inductiveautomation.com/t/automatically-update-an-instance-property-based-on-value-from-a-sibling-instance-property/86068/3 "2024-02-21T01:37:20Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Jose\_Rodolfo\_Mutuc](https://avatars.discourse-cdn.com/v4/letter/j/e0b2c6/32.png) [@Jose\_Rodolfo\_Mutuc](https://forum.inductiveautomation.com/u/Jose_Rodolfo_Mutuc)\
**Post date:** [February 21, 2024, 1:38am UTC](https://forum.inductiveautomation.com/t/automatically-update-an-instance-property-based-on-value-from-a-sibling-instance-property/86068/4 "2024-02-21T01:38:20Z")

</div>

```auto
	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

```

---

<div class="post-metadata">

**Author:** ![Jose\_Rodolfo\_Mutuc](https://avatars.discourse-cdn.com/v4/letter/j/e0b2c6/32.png) [@Jose\_Rodolfo\_Mutuc](https://forum.inductiveautomation.com/u/Jose_Rodolfo_Mutuc)\
**Post date:** [February 21, 2024, 1:43am UTC](https://forum.inductiveautomation.com/t/automatically-update-an-instance-property-based-on-value-from-a-sibling-instance-property/86068/5 "2024-02-21T01:43:16Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/d/dde79723860c2be11351f22d105915715e9a934c.png)

---

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [February 22, 2024, 2:20am UTC](https://forum.inductiveautomation.com/t/automatically-update-an-instance-property-based-on-value-from-a-sibling-instance-property/86068/6 "2024-02-22T02:20:32Z")

</div>

> [@Transistor](#):
>
> Note that you have not itnitialised **Package**. If you don't get a match for `machine == Equipment` then you will have an error.

^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:

```auto
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:

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

```

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [February 22, 2024, 9:38am UTC](https://forum.inductiveautomation.com/t/automatically-update-an-instance-property-based-on-value-from-a-sibling-instance-property/86068/7 "2024-02-22T09:38:09Z")

</div>

Agreed.  
Here's a link to the Expression Language [lookup()](https://www.docs.inductiveautomation.com/docs/8.1/appendix/expression-functions/logic/lookup) documentation.
