Total Number of Items Calculation script in Acrobat

I am playing about with Acrobat 8 Pro to create a working Purchase Requisition that will calculate values automatically.

One feature I would like to explore is the ability to sum up how many items have been added to a list up to a total of 10.

The fields I need counted are named 'Item_1" "Item_2" etc up to "Item_10" and using a calculation on the field "Total_Items" I would like a count of all of the item fields with info in them.

Is this at all possible?
ultra-itAsked:
Who is Participating?
 
Karl Heinz KremerConnect With a Mentor Commented:
Open the property dialog for your "Total_Items" field and select the "Calculate" tab. Select a custom calculation script and use the following JavaScript (if you have more than 10 fields, you will have to adjust the loop):
var total = 0;
for (var i=1; i<=10; i++)
{
    var name = "Item_" + i;
    var f = this.getField(name);
    if (f.value.length > 0)
    {
        total++;
    } 
}

event.value = total;

Open in new window

0
 
Karl Heinz KremerCommented:
That's definitely possible. Are you using AcroForm or Designer forms?
0
 
ultra-itAuthor Commented:
I am using AcroForm.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.