ONEOF |
Scroll |
The ONEOF function determines whether a particular value is equal to one (1) or more comparison values. If at least one of the specified comparison values matches the source value, a true (1) is returned. Otherwise, a false (0) is returned.
Category
Boolean
Syntax
ONEOF(value, comparison_value1, comparision_value2 [, comparison_valueN])
Parameter Descriptions
value - This parameter specifies the source value to be tested by the ONEOF function. This value can be a field from a source datastore, a variable, a constant or the result of another Function.
comparison_value1-n - One or more values that are to be compared against the source value to determine whether or not a match exists. A search value may be a field/column of a datastore, a constant, a variable or the result of another Function.
1 | 0 Indicates whether a TRUE (1) or FALSE (0) was returned from the ONEOF function.
Example
Find all of the employees who have the middle initial (EMP_MI) of X or Z. If a match is found, set the variable ODD_MI to the constant Y. Otherwise, set the variable ODD_MI to the constant N.
IF ONEOF(EMP_MI, 'X', 'Z') = 1
{
ODD_MI = 'Y'
}
ELSE
{
ODD_MI = 'N'
}