Copy link to clipboard
Copied
For example. There are occasions when I need the number to say $60,000.125. But another line might cost $12,000.670 But I want it to read $12,000.67 when the third place is zero. Any thoughts? Please help!
Thank you!
Copy link to clipboard
Copied
Is this a calculated value? If so, what code are you using for it?
Copy link to clipboard
Copied
Copy link to clipboard
Copied
You'll have to use a custom Format script to be able to do it.
Copy link to clipboard
Copied
Where can I find information on a custom format script? I'm new to this. Sorry!
Copy link to clipboard
Copied
Here's an article:
https://acrobatusers.com/tutorials/formatting_text_fields
In your case you'll need to use the "util.printf()" function.
Here's the reference entry
You'll want to use the float formating options something like
event.value = util.printf("%0.2f",event.value);
You may need extra code to detect non-number field values.
Copy link to clipboard
Copied
It may sound a bit esoteric, but there is actually a difference between 1.230 and 1.23.
In the first case, the precision is ensured to be 3 digits, whereas in the second case, it is 2 digits. For common uses, this does not make much of a difference, but if you have to ensure the precision over the whole process, it does matter.
Copy link to clipboard
Copied
Calculating with money needs a special discipline, otherwise auditors and lawyers will be upset.
Consider this purchase
ITEM 1 1.124
ITEM 2 1.124
ITEM 3 1.124
TOTAL 3.372
Ok, let's round these to the nearest cent on each line
ITEM 1 1.12
ITEM 2 1.12
ITEM 3 1.12
TOTAL 3.37
However, anyone can see this no longer adds up. This is inviting legal action, or a complete loss of cusomer confidence. You actually have to really round each line item's price, not just show less digits on the page
ITEM 1 1.12
ITEM 2 1.12
ITEM 3 1.12
TOTAL 3.36