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

PDF Form Percentage calculation...

Explorer ,
Feb 28, 2018 Feb 28, 2018

Copy link to clipboard

Copied

I have a script to get the Percentage calculation, but i have to put a space before the percentage symbol as required by french translation eg. (100 %). I could not find it in the forms properties. Is there a way to get it in the script?

if (this.getField("Total").value != "") {

event.value = (this.getField("YOU SAVE").value /

this.getField("Total"). value)

}

TOPICS
PDF forms

Views

15.2K

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 , Feb 28, 2018 Feb 28, 2018

event.value = Math.round((this.getField("YOU SAVE").value / this.getField("Total"). value)*100);

Votes

Translate

Translate
Community Expert ,
Mar 17, 2021 Mar 17, 2021

Copy link to clipboard

Copied

Try this:

var v1 = Number(this.getField("Omsetning 2018").valueAsString);
var v2 = Number(this.getField("Omsetning 2019").valueAsString);
if (v2==0) event.value = "";
else event.value = Math.round(((v2-v1)/v1)*100); 

 

However, I think you have a mistake in your example #2. If the value in the second field is 200 and in the first it's 100 it's an increase of 100%, not 200%.

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 Beginner ,
Mar 18, 2021 Mar 18, 2021

Copy link to clipboard

Copied

Thank you do much! And yes, you are of course right 🙂 100 to 200 is an increase of 100 % 🙂

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 Beginner ,
Oct 03, 2021 Oct 03, 2021

Copy link to clipboard

Copied

LATEST

Hi, I want to add two condition here. 


1. The result appear with % sign. 
2.  If "YOU Save" field is empty, The field appear blank. 


I know this will be very easy for you guys but I am new in this field and trying to learn stuff without technical background. 


Thanks!

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 ,
Jun 23, 2020 Jun 23, 2020

Copy link to clipboard

Copied

%field show only 18%         not for 18.00000000% pleae anyone help me

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