The NE (not equal) function determines whether or not two (2) values are not equal to each other. If the values are not equal to each other, a one (1) is returned, otherwise, a zero (0) is returned. The NE function operates in the opposite manner as the EQ (equal) function.
The less than/greater symbols (<>) can also be used to perform this function and is the recommended method.
Category
Boolean
Syntax
NE(value1, value2) or value1 <> value2
Parameters and Descriptions
Parameter | Description |
---|---|
value1 | This parameter specifies the first value to be used in the not equal comparison. This value may be a field/column of a source datastore, a constant value, a variable or the result of another Function. |
value2 | This parameter specifies the second value to be used in the not equal comparison. This value may be a field/column of a source datastore, a constant value (i.e. ABC), a variable or the result of another Function. |
1 | 0 | Indicates whether a TRUE (1) or FALSE (0) was returned from the NE function. |
Example
Compare an employee’s yearly salary (YR_WAGE) against their total compensation (TOTAL_COMP) to determine if they are different. If the YR_WAGE and TOTAL_COMP fields are not equal, set variable BONUS to the constant Y. Otherwise, set the variable BONUS to the constant N.
IF YR_WAGE <> TOTAL_COMP
{
BONUS = 'Y'
}
ELSE
{
BONUS = 'N'
}