I posted this question about a week ago and unfortunately have had no response. As I will have many different clients completing this form, adding many lines of data, it is quite likely that they will save the form and reopen it to add more items. It is when the form is saved and reopened that any entered negative amounts are omitted in the total calculation. This also happens when the form is submitted and subsequently opened.
var TotalRes = 0
if (exists(details.Premium) == 1) then
TotalRes = Sum(details[*].Premium)
endif
Is there anything that this is missing or anything that can be added to ensure that negative amounts are included in the Total Calculation?
The field is bound as $z,zzz,zz9.99
Please Help!
Thanks
calculate (Form Calc)
//Verify at least one instance of the cost field exists
if (exists(details[0].cost == 1) then
Sum(details[*].cost)
endif
On the Add Row button and Delete button (repeating subform) on Click Event (JS)
//invoke the recalculate method to include the field values from the added subforms in calculations.
xfa.form.recalculate(1);