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

Creating if/then condition for complex calculation

New Here ,
Oct 08, 2017 Oct 08, 2017

I have made a calculation for a field:

this.getField("Rental Year 3").value = (this.getField("Rental Year 2").value * (this.getField("Annual Increase").value /100)) + this.getField("Rental Year 2").value;

However, I only want the calculation to apply if another field (Lease Term) has a value greater than or equal to 3. If the value is less than three I would like this field to equal 0.

How do I add this condition?

TOPICS
Acrobat SDK and JavaScript , Windows
323
Translate
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 , Oct 09, 2017 Oct 09, 2017

Use something like this:

var val = 0;

if (this.getField("Lease Term").value >= 3)

  val = (this.getField("Rental Year 2").value * (this.getField("Annual Increase").value /100)) + this.getField("Rental Year 2").value;

this.getField("Rental Year 3").value = val;

Translate
Community Expert ,
Oct 09, 2017 Oct 09, 2017
LATEST

Use something like this:

var val = 0;

if (this.getField("Lease Term").value >= 3)

  val = (this.getField("Rental Year 2").value * (this.getField("Annual Increase").value /100)) + this.getField("Rental Year 2").value;

this.getField("Rental Year 3").value = val;

Translate
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