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

Help with an IF THEN Calculation in PDF Form

New Here ,
May 14, 2020 May 14, 2020

Copy link to clipboard

Copied

I am trying to do an IF THEN Calculation in PDF Form.  This is beyond my expertise with PDF.  There are 3 fields.  A1, B1, C1.    If A1 is greater than B1, then calculate A1-B1 =C1. If A1 is less than B1 then C1 would equals 0.  For example.

A1 =24

B1 =20

C1=4

 

or

A1=19

B1 =20

C1= 0

 

Can anyone help with this?

 

Thank you

TOPICS
Acrobat SDK and JavaScript

Views

345

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 , May 15, 2020 May 15, 2020

Use this:

 

var a1 = Number(this.getField("A1").valueAsString);
var b1 = Number(this.getField("B1").valueAsString);
if (a1>b1) event.value = a1-b1;
else event.value = 0;

Votes

Translate

Translate
Community Expert ,
May 15, 2020 May 15, 2020

Copy link to clipboard

Copied

LATEST

Use this:

 

var a1 = Number(this.getField("A1").valueAsString);
var b1 = Number(this.getField("B1").valueAsString);
if (a1>b1) event.value = a1-b1;
else event.value = 0;

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