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

Divide with an if statement

New Here ,
Feb 13, 2023 Feb 13, 2023

Copy link to clipboard

Copied

I am trying to divide with an if statement.

If "Field A" = "x" divide "Field B" by "#"

if "Field A" = "y" divide "Field B" by "1" or do nothing. 

TOPICS
General troubleshooting , How to , JavaScript , PDF forms

Views

477

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 ,
Feb 13, 2023 Feb 13, 2023

Copy link to clipboard

Copied

LATEST

You'll need to use a custom script. I'm assuming this is for a calculation. 

var oFldA = this.getField("Field A");
var oFldB = this.getField("Field B");
if(oFldA.value == "x")
   event.value = oFldB.value/#;
else 
   event.value = oFldB.value;

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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