Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Calculating averages

Avatar

Level 4
Is there a way of calculating numeric averages? For instance, I have 10 numeric fields, that I need to average and put the result in an 11th field. Now the twist (you knew this was coming right??) -- if a field does not contain a numeric value or the value equals 0.0 then it should not reflect in the average.



Am I asking the impossible?
8 Replies

Avatar

Former Community Member
It's not impossible - but you need to write some script to do it. You can step through the fields you have checking each one to see if the value is one you want to include, add to a field counter and add the value to an accumulator.. then when you're done, divide the accumulator by the field counter.



I've attached a simple form that does this for a form with just two fields, take a look and see if this is what you need.

--

SteveX

Adobe Systems

Avatar

Level 4
Thanks SteveX for the quick response.



I was able to save and open the CalcAverage.pdf but when I went to test it in PDF View it hung. I also found when I brought the code in my PDF it also hung when I tried to test it.



Did I miss some hidden code somewhere?

Avatar

Level 4
Hi Steve. I'm still not able to use the code you provided (CalcAverage.pdf will not function correctly). Is there something I'm missing -- ie hidden code?



I'd appreciate any further assistance you can offer.

Thanks. ....b

Avatar

Former Community Member
Hmm.. I don't know why it would be doing that for you - it's worth checking, do you have the latest version of Acrobat (7.0.7)? I don't think you should need it for this but 7.0.5 or later would be a good idea anyway..



--

SteveX

Adobe Systems

Avatar

Level 4
I have Acrobat 7.0.5 and Designer 7.0.



Are there any problems with installing Acrobat 7.0.7? I think I read somewhere that Designer 7.1 doesn't install "on top" of 7.0? And that 7.0 should be uninstalled first?

Avatar

Former Community Member
I don't have an official answer for that but I can say that for me, having both installed seems to work fine.



--

SteveX

Adobe Systems

Avatar

Former Community Member
I am new to using LiveCycle and am trying to create an employee evaluation form. I need to average 2 to 5 fields of numeric data into 5 separate columns and then calculate the average of the 5 columns into 1 final column. I have attached a copy of the form I am attempting to create. PLEASE HELP!

Thanks

Avatar

Former Community Member
matt maley, here's some info that will help you.



1. Look for a file called Adobe_XML_Form_Object_Model_Reference.pdf.

I'm sure if you search these forums, you'll find a link that works. There are examples in the later chapter that you will find helpful.

2. Go to www.w3schools.com. They have a good JavaScript reference that is free and it's easy to find solutions. Plus, they have helpful interactive examples.



Good luck,

Stone.