# Expression not updating when dataset changes

**URL:** <https://forum.inductiveautomation.com/t/expression-not-updating-when-dataset-changes/4149>\
**Category:** Ignition\
**Created:** [March 14, 2012, 4:06pm UTC](https://forum.inductiveautomation.com/t/expression-not-updating-when-dataset-changes/4149 "2012-03-14T16:06:44Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jonathan](https://avatars.discourse-cdn.com/v4/letter/j/aeb1de/32.png) [@Jonathan](https://forum.inductiveautomation.com/u/Jonathan)\
**Post date:** [March 14, 2012, 4:06pm UTC](https://forum.inductiveautomation.com/t/expression-not-updating-when-dataset-changes/4149/1 "2012-03-14T16:06:44Z")

</div>

I have this expression binding on a text box

```auto
try(tostr(toint(lookup({Root Container.SalesData},{Root Container.Container_1.SKU},0,"SKU","Outlet_Previous"))),"")
```

on the dataset {Root Container.SalesData} i have a dynamic SQL query bound that uses drop down box labels for parameters. when I change the drop down selections i can see the dataset changes, but my lookup binding on my text box does not seem to update every time. the data set always has the same column names, amount of rows, and amount of columns the only thing that changes in the data set is the values in the cells. any ideas why my expression is not updating when the dataset changes?

Thank you,

---

<div class="post-metadata">

**Author:** ![Travis.Cox](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Travis.Cox](https://forum.inductiveautomation.com/u/Travis.Cox)\
**Post date:** [March 14, 2012, 4:23pm UTC](https://forum.inductiveautomation.com/t/expression-not-updating-when-dataset-changes/4149/2 "2012-03-14T16:23:06Z")

</div>

What is the {Root Container.Container\_1.SKU} property bound to?

---

<div class="post-metadata">

**Author:** ![Jonathan](https://avatars.discourse-cdn.com/v4/letter/j/aeb1de/32.png) [@Jonathan](https://forum.inductiveautomation.com/u/Jonathan)\
**Post date:** [March 14, 2012, 4:28pm UTC](https://forum.inductiveautomation.com/t/expression-not-updating-when-dataset-changes/4149/3 "2012-03-14T16:28:13Z")

</div>

a lookup on the same dataset

```auto
lookup({Root Container.SalesData},toint(split({Root Container.Container_1.name},"_")[1,0]),"","RowNum","SKU")
```

---

<div class="post-metadata">

**Author:** ![Jonathan](https://avatars.discourse-cdn.com/v4/letter/j/aeb1de/32.png) [@Jonathan](https://forum.inductiveautomation.com/u/Jonathan)\
**Post date:** [March 14, 2012, 4:29pm UTC](https://forum.inductiveautomation.com/t/expression-not-updating-when-dataset-changes/4149/4 "2012-03-14T16:29:57Z")

</div>

could the lookups be firing out of order. let me try combining them into one expression.

---

<div class="post-metadata">

**Author:** ![Jonathan](https://avatars.discourse-cdn.com/v4/letter/j/aeb1de/32.png) [@Jonathan](https://forum.inductiveautomation.com/u/Jonathan)\
**Post date:** [March 14, 2012, 4:32pm UTC](https://forum.inductiveautomation.com/t/expression-not-updating-when-dataset-changes/4149/5 "2012-03-14T16:32:44Z")

</div>

combining the lookups does not seem to solve the issue.

---

<div class="post-metadata">

**Author:** ![Jonathan](https://avatars.discourse-cdn.com/v4/letter/j/aeb1de/32.png) [@Jonathan](https://forum.inductiveautomation.com/u/Jonathan)\
**Post date:** [March 14, 2012, 5:49pm UTC](https://forum.inductiveautomation.com/t/expression-not-updating-when-dataset-changes/4149/6 "2012-03-14T17:49:30Z")

</div>

this is what i did that seems to force the expressions to update.

on the drop down box I put this code

`if(event.propertyName == "selectedIndex"):
	event.source.parent.parent.SalesData = system.dataset.toDataSet(["Distributor","Custnmbr","SKU","Sales_Previous"\
		,"Sales_Current","Outlet_Previous","Outlet_Current","SortOrder","Label","RowNum"],[])`

now when one of the parameters is changed the dataset is set with 0 rows before the drop down label changes. let me know if you see any issue with this.
