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

Need help with form calculation

rbr00x
Registered: Oct 14 2009
Posts: 26
Answered

Using Acrobat Professional 9, I need to calculate the total of a number of fields, but I only want to include the fields that have a checkbox with an export value of "Primary". There are six fields total, and there could be from 1 to 6 of those fields set to Primary. I am not sure the most efficient way to do this. I would appreciate suggestions!
 
Thank you,
Renee

My Product Information:
Acrobat Pro 9.2, Windows
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
How are the check boxes mapped to the text fields?

What are the field names?

Are you using Acrobat's form toolbar or LiveCycle Designer to create the form?

George Kaiser

rbr00x
Registered: Oct 14 2009
Posts: 26
Ok the text fields are:
bene1_pct
bene2_pct
bene3_pct
bene4_pct
bene5_pct
bene6_pct

Checkboxes are
bene1_type
bene2_type
bene3_type
bene4_type
bene5_type
bene6_type

What we're gathering are beneficiary designations, so whether it is a primary or contigent beneficiary and what percentage they get. The percentages for primary and contingent (if there is a contingent) each need to total 100%.
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
Accepted Answer
I will assume you are using Acrobat's form tool and not LiveCycle Designer.

For the field that totals the "Primary" selection you can use the follwing "custom calculation script";

var Total = 0;
for( i = 1; i < 7; i++) {
if(this.getField("bene" + i + "_type").value == "Primary")
Total += Number(this.getField("bene" + i + "_pct").value);
} // end for loop
event.value = Total;

George Kaiser

rbr00x
Registered: Oct 14 2009
Posts: 26
Thank you so much, works perfectly!