Simplified Field Notation and Calculate - Rounding

New Here ,
Aug 17, 2022 Aug 17, 2022

Copy link to clipboard

Copied

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

 

TOPICS
General troubleshooting , How to , JavaScript

Views

26

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
community guidelines

correct answers 1 Correct answer

Community Expert , Aug 17, 2022 Aug 17, 2022

As the custom Validation script enter the following code:

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

Likes

Translate

Translate
Community Expert ,
Aug 17, 2022 Aug 17, 2022

Copy link to clipboard

Copied

As the custom Validation script enter the following code:

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

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
community guidelines
New Here ,
Aug 17, 2022 Aug 17, 2022

Copy link to clipboard

Copied

LATEST

try67! many thanks that worked. 

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
community guidelines