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

Help writing custom calculation similar to an IF stmt in excel.

New Here ,
Jan 31, 2017 Jan 31, 2017

Hi! I need help writing a custom calculation.  Basically, If Box 1>Box 2, then value should be Box 1- Box 2.  Otherwise, box should be blank. How do I do this?

TOPICS
Acrobat SDK and JavaScript
363
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 , Jan 31, 2017 Jan 31, 2017

var v1 = Number(this.getField("Box 1").valueAsString);

var v2 = Number(this.getField("Box 2").valueAsString);

if (v1>v2) event.value = v1-v2;

else event.value = "";

Translate
Community Expert ,
Jan 31, 2017 Jan 31, 2017
LATEST

var v1 = Number(this.getField("Box 1").valueAsString);

var v2 = Number(this.getField("Box 2").valueAsString);

if (v1>v2) event.value = v1-v2;

else event.value = "";

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