These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Add Instance not calculating negatives on submit

realname
Registered: Aug 15 2008
Posts: 93

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

My Product Information:
LiveCycle Designer, Windows
R_Boyd
Registered: Nov 1 2007
Posts: 151
I have a similar form and have used the following scripts

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);
realname
Registered: Aug 15 2008
Posts: 93
I tried this and though the form calculates, when the data is saved and the form reopened, any negative amounts are no longer included in the total calculation. The negative amounts seem to be ignored completely; they are neither added or subtracted from the total no matter what I try.

I have put the recalculate script in form initialize as well as on the add or delete buttons all without results.