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
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?