These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Use of If Then formula

twing
Registered: Nov 29 2011
Posts: 1

Hello all,
 
I would like to start by saying I am a complete novice when it comes to creating forms in Acrobat, it's all trial and error and mostly error.
 
Here is my question: I have a form that I have converted from Excel to Acrobat. It contains the following "If" formula =IF(C1>75,C1-75,0). Can someone tell me how to make that calculate in Abobe Acrobat 9 Professional?
 
Thank you in advance for any help you can give!
 
Tammie

My Product Information:
Acrobat Pro Extended 9.0, Windows
George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1875
Here's one way:

// Custom Calculate script for text field

// Get the value of the C1 field, as a number
var v1 = +getField("C1").value;

// Set this field value
event.value = v1 > 75 ? v1 - 75 : 0;This code assumes the input field is named "C1", so change that to match the name of your field.

The last line is equivalent to:

if (v1 > 75) {
event.value = v1 - 75;
} else {
event.value = 0;
}
George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1875
The forum software screwed up the last line of code. It should read:

event.value = v1 > 75 ? v1 - 75 : 0;