Very odd behavior

Issues with calculations on templateForm.

I have 2 fields, Commission 1 and Commission 2.
Those Total into Commission Total. This works perfectly every time a change event happens on either Commission 1 or Commission 2.

I have another field that is the Gross Profit Commission which is Gross_Profit - CommissionTotal. This is where the problem begins, if I set Commission1 and then Commission2, Commission Total is correct as is the GPCommission. If I set Commission2 and then set or change Commission1 the CommissionTotal is correct but the GPCommission is not.

The javascript for both Commission1 and Commission2 change events are identical.

Any ideas?

You have to update all properties that depend on Commisson1 and Commission2 when they change e.g.

${formData.CommissionTotal} = ${formData.Commission1} + ${formData.Commission2};
${formData.GPCommission} = ${formData.Gross_Profit} + ${formData.CommissionTotal};

Just setting CommissionTotal will not update GPCommission.

That’s the thing I have done both calculations in that order on both Commission1 and Commission2’s change events.

I have to see the entire code. Can you attach the meta<page-name>.json file? Or you can modify the example I have attached in your other thread.