# Loading values contrary to calculatedValue in a form?

**URL:** <https://forum.inductiveautomation.com/t/loading-values-contrary-to-calculatedvalue-in-a-form/31877>\
**Category:** Ignition\
**Tags:** ignition80\
**Created:** [February 3, 2020, 6:02pm UTC](https://forum.inductiveautomation.com/t/loading-values-contrary-to-calculatedvalue-in-a-form/31877 "2020-02-03T18:02:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [February 3, 2020, 6:02pm UTC](https://forum.inductiveautomation.com/t/loading-values-contrary-to-calculatedvalue-in-a-form/31877/1 "2020-02-03T18:02:52Z")

</div>

I have two numerical field components, `num_Amount` and `num_Tax`.

Each of these has a custom property `initialValue` which has the expression  
`try({Root Container.initialData}[0,'amount'],0)` and `try({Root Container.initialData}[0,'tax'],0)` respectively.

The `num_tax` also has a custom property called `calculatedValue` with the expression `{Root Container._out_taxPercent} * {Root Container.num_Amount.floatValue}`. I then have a property change on my `tax` numeric component

```auto
if event.propertyName == 'calculatedValue':
	event.source.floatValue = event.source.calculatedValue

```

so if someone changes the amount, the tax auto-recalculates, however, if someone wants to manually change the tax after writing an amount, that works too.

The issue is when I am reloading a form custom tax numbers. Say someone put 100 as the amount and the tax calculated to 7.00, but then was overwritten to 5.00 and the form was saved.

When the form is loaded again, the tax says 7.00 because that propertyChange event was triggered. I’ve been trying to get this to ignore it the first go around using some sort of initalized custom property on it, but I realized that doing that triggers another property change and the same thing happens.

So far I’ve only been able to get this to work by controlling it from the Amount on property change, but I would like to be able to keep the logic self contained to the `num_Tax` component if possible. I need to do the same thing to another component whos calculations are based on 20-30 different components and so figuring out a self-contained way to do it instead of having the other components control it would help with maintainability going forward.

Does anyone have any ideas on how to do this?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [February 3, 2020, 6:10pm UTC](https://forum.inductiveautomation.com/t/loading-values-contrary-to-calculatedvalue-in-a-form/31877/2 "2020-02-03T18:10:52Z")

</div>

Bindings cannot really be turned off like you wish. The key is for your save operation to write to the source of the data for the root container dataset.

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [February 3, 2020, 6:18pm UTC](https://forum.inductiveautomation.com/t/loading-values-contrary-to-calculatedvalue-in-a-form/31877/3 "2020-02-03T18:18:52Z")

</div>

Scratch all that…
