5 Replies Latest reply on Feb 19, 2014 7:50 AM by George_Johnson

# Calculation errors

Hello all, it's me again....

The form I'm having fits over is located here:  https://files.acrobat.com/preview/b13eb492-d943-481b-aca7-7c8aa502f14b

The problem I'm having are with the totals at the right lower corner of the second page.

For factors A-Y, DS Sum is the total of all mathematical values assigned to each factor.

DSA is the average by taking the DS Sum and dividing it by the count which is the number of factors evaluated.

Z-AC is the same as above

DSB is the total mathematical values assigned to all factors,

the Average is the DSB / Text 19c, which is the total of Text 19a and Text19b.

The owner wants whole numbers.

The error messages I keep getting is:  The value entered does not match the format of the field.  Also, in the example I provided, It doesn't calculate correctly.  The Support Sum is 16, divided by 4, and the answer should be 4 - not 5.

All the counts and the sums seem to add up fine, it's just when I get to this area where I am runnng into problems.  Can I get a pair of fresh eyes to look at this and see why I'm not able to get this to calculate correctly?

thanks much.

Connie

• ###### 1. Re: Calculation errors

You have to make sure that when you perform a division where the denominator includes a field value, that it does not evaluate to zero, which will happen if the field is blank. For example:

var price = this.getField("DS");

var qty = this.getField("Text19");

if (price.value == 0 || qty.value == 0) event.value="";

else event.value = price.value / qty.value;

• ###### 2. Re: Calculation errors

Hi, I followed the script that George Johnson posted, but am still having a problem with it.  On the lower right side, the middle calculation, should calculate out as 16-4=4 and it’s coming out as 5.  Is there a way to get this to calculate correctly?

Thanks

Here’s the file name:  https://files.acrobat.com/preview/b8a792ef-a70e-4d93-b124-34c13ded6e34

• ###### 3. Re: Calculation errors

It looks to me like the field calculation order is incorrect. You should also set the calculated fields t read-only.

• ###### 4. Re: Calculation errors

Ok, I set the calculated fields to read only.  As far as the field calculation order is concern, I have it set up as

DS

DSA

Text19

SU

SUA

Tect19a

DSB

Average

Text19c

And it still comes out as 16 / 4 = 5. Any other reason this is doing this or how should I reorder the field calculation order?

• ###### 5. Re: Calculation errors

Shouldn't that be:

DS

Text19

DSA

SU

Tect19a

SUA

DSB

Text19c

Average

Since the last fields in each of those groups depend on the other two fields in the group?