Copy link to clipboard
Copied
I am making a simple form to take a contract amount, less payment already received, less this payment should total the balance due. When I do the calculation ContractAmount0 - PaymentReceived0 - ThisPayment0 is giving this error: The value entered does not match the format of the field [BalDue0].
Everything is set to number, 2 decimal places, with the $ symbol. It's rounding somehow.
Copy link to clipboard
Copied
You have hit a very interesting artifact of number representation in Acrobat. This is actually quite rare.
The value should be zero, but the first subtraction yields ".93999999994" instead of ".94". So the next subtraction, instead of going to zero, converts the calculation into scientific notation. The built-in formatting should just convert this to zero, but it wasn't built to handle it, so displays the errror.
The solution is to use your own formatting script. This will work.
event.value = util.printf("$%,0.2f",event.value);
Copy link to clipboard
Copied
Is the value of all of those fields a number? No other characters?
Copy link to clipboard
Copied
Just a decimal is included.
Copy link to clipboard
Copied
Can you share the actual file with us?
You can attach it to the original message using the tiny paperclip icon at the bottom when you edit it, or upload it to a file-sharing website (like Dropbox, Google Drive, Adobe Cloud, etc.), generate a share link and then post it here.
Copy link to clipboard
Copied
You have hit a very interesting artifact of number representation in Acrobat. This is actually quite rare.
The value should be zero, but the first subtraction yields ".93999999994" instead of ".94". So the next subtraction, instead of going to zero, converts the calculation into scientific notation. The built-in formatting should just convert this to zero, but it wasn't built to handle it, so displays the errror.
The solution is to use your own formatting script. This will work.
event.value = util.printf("$%,0.2f",event.value);
Copy link to clipboard
Copied
Thank you for figuring this out, but this may be a dumb question, but where do I put event.value = util.printf("$%,0.2f",event.value); does it go into the custom calculation script?
Copy link to clipboard
Copied
No, it goes into the Custom Format Script.
Copy link to clipboard
Copied
Thank you!! That did work! I appreciate your help!
Copy link to clipboard
Copied
What does you get when you set the format to None.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more