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

Divide with an if statement

New Here ,
Feb 13, 2023 Feb 13, 2023

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

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