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

If/Then Calculation - Can someone PLEASE help?

New Here ,
Jan 11, 2021 Jan 11, 2021

Copy link to clipboard

Copied

Who can help me with some easy Javascript for an Adobe form that I am creating?
 
I have FieldA, FieldB, FieldC and Total.
 
If FieldB is GREATER THAN FieldC then Total = FieldA + FieldC.
 
If FieldB is LESS THAN FieldC then Total = FieldA + FieldB.
TOPICS
Create PDF , How to

Views

67

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
Community Expert ,
Jan 12, 2021 Jan 12, 2021

Copy link to clipboard

Copied

Try the forum for Adobe Acrobat.

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
Community Expert ,
Jan 13, 2021 Jan 13, 2021

Copy link to clipboard

Copied

LATEST

Use the following code as the custom calculation script of Total:

 

var a = Number(this.getField("FieldA").valueAsString);

var b = Number(this.getField("FieldB").valueAsString);

var c = Number(this.getField("FieldC").valueAsString);

if (b>c) event.value = a+c;

else event.value = a+b;

 

Edit: small mistake fixed in the code...

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
Resources