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

IF Functions on adobe form

New Here ,
Jun 03, 2016 Jun 03, 2016

I am having difficulty with an IF function, =IF(B21>B22,B21-B22,0) this will not work in java.  Any help would be greatly appreciated.

TOPICS
Acrobat SDK and JavaScript
366
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
LEGEND ,
Jun 03, 2016 Jun 03, 2016

Acrobat forms use JavaScript and not Excel functions. There is no if function on JavaScript

There is an if statement whose syntax is very different.

Have looked at any JavaScript tutorials or Acrobat scripting tutorials?

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
New Here ,
Jun 03, 2016 Jun 03, 2016

Yes, I am aware that I cannot use excel functions, I only placed that there as an example.  It was the best way I could describe what I am trying to achieve.

I've researched the scripting until my eyeballs burn , so any assistance anyone could offer would be very much appreciated.

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
LEGEND ,
Jun 03, 2016 Jun 03, 2016
LATEST

Assuming that you want this to be a custom calculation script for a field, it could be something like:

// Custom calculation script for text field

(function () {

    // Get the field values, as numbers

    var B21 = +getField("B21").value;

    var B22 = +getField("B22").value;

    // Set this field's value

    event.value = B21 > B22 ? B21 - B22 : 0;

})();

Change "B21" and "B22" in the getField statements with the actual names of the fields in your form.

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