IF
The IF statement compares the contents of two fields, or compares the contents of a field with a constant, and sets the next level of the internal true/false flag.
????? IF ??? ?????????????????????? ??? ?? ??? ?????????????????????? ???
(1) (2) (3) (4) (5)(6) (7) (8)
(1) T/F execution conditions
(2) 1st application ID
(3) 1st field name or PDF
(4) 1st occurrence (constant/index)
(5) Relation (LT,GT,LE,GE,EQ,NE,IN,EX, RI, RS)
(6) 2nd application ID
(7) 2nd field name, PDF, or constant
(8) 2nd occurrence (constant/index)
Sets True/False Status Indicator
In comparing the contents of two fields, or a field with a constant, the next level of the true/false status indicators is set to T if the condition is true, or F if the condition is false. See True/False Status Indicators for details on using these indicators.
Using the Statement
The IF statement specifies a relationship between two values. The valid relational operators are:
less than (LT), greater than (GT), less than or equal to (LE), greater than or equal to (GE) equals (EQ), not equal to (NE), includes (IN), excludes (EX), regular expression case insensitive (RI) and regular expression case sensitive (RS) .
The relation IN means 'includes'. The relation is true if the value in the second field is included in the first field, and false otherwise. If the relation is true, the predefined field TEXT AT POSITION is set to the starting position of the second field within the first field. The first field must be an alpha field; the second can be either an alpha field or a constant. Trailing blanks are ignored if the second field is a constant; however, you may specify fixed spaces (by entering underscores) to include one or more trailing spaces as part of a character string that is being searched.
RI and RS require a search string in the 2nd field name. The syntax of the search string may depend on the operating system where Appx is installed. Consider the following examples. All will check for 9 digits in the TEMP 30 field. All of these IF statements will work on a Windows server, but only the first (using character groups) or last (using Posix character classes) will work on Linux.
IF --- TEMP 30 RI ^[0-9]{9}$
IF --- TEMP 30 RI ^\d{9}$
IF --- TEMP 30 RI ^[[:digit:]]{9}$
Restrictions
The IF statement supports comparisons between like data types only (alpha-to-alpha, numeric-to-numeric, date-to-date, logic-to-logic). When comparing two date fields, results can be unpredictable if you are using a date field without a century component. Confirm that your System Administrator has set up the Pivot Year environment variable to avoid unexpected results.
Related PDFs
TEXT AT POSITION
Related Statements
AND, OR
Example
In this example, if the customer's balance is greater than his credit limit, an error message is given and the balance field blinks; otherwise, no action is taken.
IF TAR CUSTOMER BALANCE GT TAR CUSTOMER CREDIT LIMIT
T ERROR Customer's balance exceeds credit limit!
T BLINK TAR CUSTOMER BALANCE
|