Highlighted

How do I hide third place decimal when it's zero?

New Here ,
May 08, 2019

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!

Topics

Macintosh, PDF forms

Views

419

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

How do I hide third place decimal when it's zero?

New Here ,
May 08, 2019

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!

Topics

Macintosh, PDF forms

Views

420

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Most Valuable Participant ,
May 08, 2019

Copy link to clipboard

Copied

Is this a calculated value? If so, what code are you using for it?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
New Here ,
May 08, 2019

Copy link to clipboard

Copied

Screen Shot 2019-05-08 at 11.37.30 AM.png

This is what I have. I'm just using the regular formatting when creating a form. Qty x Unit price = Amount

Looking for when the third decimal is zero, to be hidden if possible. Does that make sense?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Most Valuable Participant ,
May 08, 2019

Copy link to clipboard

Copied

You'll have to use a custom Format script to be able to do it.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
New Here ,
May 08, 2019

Copy link to clipboard

Copied

Where can I find information on a custom format script? I'm new to this. Sorry!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
May 08, 2019

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

Acrobat DC SDK Documentation

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Advocate ,
May 08, 2019

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Most Valuable Participant ,
May 09, 2019

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Resources
One Stop Solution for Acrobat
Edit a PDF
Add a group