• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

2.6K

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
1 ACCEPTED SOLUTION
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);

View solution in original post

Votes

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
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);

Votes

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

try67! many thanks that worked. 

Votes

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 ,
Oct 05, 2023 Oct 05, 2023

Copy link to clipboard

Copied

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

Votes

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
Community Expert ,
Oct 05, 2023 Oct 05, 2023

Copy link to clipboard

Copied

LATEST

This has been discussed many times in the past, and full code samples have been given.

If you want to do it yourself try searching for similar questions, and also read these tutorials:

https://acrobatusers.com/tutorials/conditional-execution

https://acrobatusers.com/tutorials/change_another_field

https://acrobatusers.com/tutorials/show_hide_fields

https://acrobatusers.com/tutorials/js_list_combo_livecycle

https://acrobatusers.com/tutorials/list_and_combo_in_lc

 

If you're interested, I've developed some similar scripts in the past and could write for you the custom code needed to do what you're after, for a fee. You can contact me privately (via PM) to discuss it further.

Votes

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