Skip to main content
Participant
August 17, 2022
Answered

Simplified Field Notation and Calculate - Rounding

  • August 17, 2022
  • 1 reply
  • 3934 views

Hello 

 

So i have a calculated field in my PDF which is a ratio of 2 other fields in the PDF. 

eg. 

Final List Price (sa11) = 300

Sale Price (s1) = 100

Final List to Sale Ratio = (s1/sa11)*100 

 

In the Ratio field properties i have selected the 'Cutom' format option and put in the following script to avoid showing 'NaN' and Infinity since the user would not have filled in the fields yet.

 

Format Tab -- Custom Format Script

if (event.value == "NaN" || event.value == Infinity) {event.value = "";}

 

In the Calculate tab i put in the following formula in the 'Simplified Field Notation' area 

 

-- Simplified FIeld notation on the Calculate tab

(s1/sa11)*100

 

 

My problem is HOW DO I ROUND THE final calculated RATIO to 2 decimals. I tried many things but nothing is working. I am new this and am sure i am doing something wrong. 

 

Have attached pictures below

 

This topic has been closed for replies.
Correct answer try67

As the custom Validation script enter the following code:

if (event.value) event.value = event.value.toFixed(2);

1 reply

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
August 17, 2022

As the custom Validation script enter the following code:

if (event.value) event.value = event.value.toFixed(2);

Participant
August 17, 2022

try67! many thanks that worked. 

Participant
October 5, 2023

try67! or anyone that may be able to help. I am new to Adobe, calculation script, java script, pretty much everything. 

 

I am trying to make a form that has has to do the following:

1. A drop down box with different selections (i.e. A-1 thru A-107)

2. Once a selection is made, I need to be able to select options to appear under the first selection. 

   i.e. Select A-2, then has 9 sub boxes that can be checked.

3. Once the selection is made, only the selected item(s) will show in the box.

 

Please assist. thanks. 

Gordon