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

Form Fields Calculating Incorrectly

jmason
Registered: Jun 22 2007
Posts: 73

Hello, I have created a form for someone else in my organization, and she is having a difficult time getting the calculations to work in Reader. I'll explain the fields involved:

Field N1602 calculates the sum of 44 fields above it (total Settlement charges), set with Number format (dollar fields). This field copies to another field, which is included in another calculation on the page.

Field N1520 calculates the sum of 15 fields above it (total Disbursed), set with Number format (dollar fields). This field also copies to another field, which is included in another calculation on the page.

Fields N1600 and N1601 are for data input only (no calculations in these).

Field N1604 calculates a simple calculation as follows: N1600+N1601-N1602-N1520 (total Disbursements). As stated before, fields N1602 and N1520 have two fields each, that copy to one another.

The person who is having problems is getting the following message when entering an amount into field N1601:
"The value entered does not match the format of the field [N1604]".

Also, field N1604 is not coming up with a correct total for her.

She also said that if she needs to go back and correct a field (one of the 44 or 15 fields above the first two calculated fields), it won't adjust the totals.

I am starting to become quite confused with the issue, and because math has never been my strong suit, I am not understanding why she is not coming up with a correct total. I checked the calculation order, and arranged it to be correct. But she’s still coming up with that error message.

Thanks in advance for any help with this!

gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
Are you performing any division?

You maybe trying to add a numbers as a text string and not numbers. Try forcing the values being added to be a number and not a character string of numbers.

George Kaiser

try67
Expert
Registered: Oct 30 2008
Posts: 2399
Also, check the field calculation order.

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

jmason
Registered: Jun 22 2007
Posts: 73
gkaiseril:
Thank you for your response...however, I do not understand the difference between a "number" and a "character string of numbers". How would I force the values?
The field N1604 has a Simplified Field Notation with the calculation above...N1600+N1601-N1602-N1520. Is this what you mean? Is there another way to format the calculation?

Thank you!
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
Yes, Acrobat runs on computers and computers have many way to store data. The basic storage unit of data is the 8 bit byte and most PCs use the ASCII character set or some extension of that set. Each ASCII character requires 1 byte of data. One Cord use 3 bytes of data to store the numeric value 255, but if one uses all 8 bits of a byte to store the number, then only one byte of data can be used. So computers tend to store numeric data in a binary format or other abbreviated method to save computer memory space for other tasks.

Acrobat JavaScirpt stores numeric data using the IEEE 754 standard to store numeric data and the filed object has the properties of 'value' and 'valueAsString'. From the Acrobat JS API Reference:

Quote:
value: The value of the field data that the user has entered. Depending on the type of the field, may be a String, Date, or Number. Typically, the value is used to create calculated fields.
Quote:
valueAsString: It differs from value, which attempts to convert the contents of a field contents to an accepted format. For example, for a field with a value of “020”, value returns the integer 20, while valueAsString returns the string “020”.
If you look at the 'Calculate' tab for a field, there are 3 options available for calculations with varying degrees of flexibility. If one selects the first option of 'Field is the ____ of the following fields:', the 'Simplified field notation' and 'Custom calculation script'. The first option treats a null or empty field as a value of zero. The simplified field notation lets JavaScript guess the type of the data as string or numeric and the '+' operator action depends upon what JavaScript assumes the data type is, either the concatenation operator or the addition operator. The custom calculation script allows the user to force the type as needed.

One can force a value to a numeric value by multiplying the value by 1.

George Kaiser