Skip to main content
Participant
June 3, 2016
Question

IF Functions on adobe form

  • June 3, 2016
  • 2 replies
  • 405 views

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.

This topic has been closed for replies.

2 replies

Inspiring
June 3, 2016

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.

Inspiring
June 3, 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?

Participant
June 3, 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.