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

add a column of numbers & then find average

AnnConnolly
Registered: May 5 2009
Posts: 5

I have created a utility form for my clients to fill out & email the data back to me. Is there a way in Acrobat 8 Pro or Livecycle to calculate a column of numbers in my form then divide by 12 & insert the answer automatically?

Ann

My Product Information:
LiveCycle Designer, Windows
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
In Acrobat you use the builtin calculation opotion or write your own scritpt. LiveCycle Designer's FormCalc has an 'Avg()' fucniton.

George Kaiser

AnnConnolly
Registered: May 5 2009
Posts: 5
Where is the how to file so I can figure out how to do it. I have not been successful in finding the directions. I wadded my way through setting up the form emailing it & importing the data once I get if back but finding the code to add the columns & find the average has escaped me. Where can I find help directions. I figured there was a way to do it but finding somewhat simple directions is what eludes me. Thanks.

Ann

gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4307
In LiveCycle Designer on the menu bar select "Help" and then the "Scripting Reference" and a new window will open with the LiveCycle Designer Scripting Reference document. If you click on the "Search" tab and enter "Average" for the search term and click the "List Topics" buttons you will be provided with a list of topics where the term "Average" appears. If select the "Avg" and click the "Display" button or just double click the item, you will bring up the page for the "Avg" function with an explanation and examples of entering just values, field names, the multiple occurrences in an array.

So if you create 12 decimal fields all called "DecimalField1" you will have 12 fields with a name of "DecimalField1" followed by "[#]" where "#" is the specific occurrence number of the field, from 0 to 11. You can now make a decimal field called "Average" and for the "Calculation" event enter:

Avg(DecimalField1[*])
This code will sum and count all the non-null values of "DecimalField1" and divide the sum by the count and place the result in the "Average" field. There are also a "Sum" and "Count" function available if you need to perform a different calculation of the average. You can also list each individual field to average:

Avg(DecimalField1[0], DecimalField1[1], DecimalField1[2], ... DecimalField1[11])
If you need help with creating a LiveCycle Form, there are eSiminars on demand that cover a number of topics including [url=http://www.acrobatusers.com/events/online/245]Extending LiveCycle Forms with JavaScript and FormCalc[/url] presented by Thom Parker.

George Kaiser