Developer Documentation Library > UNICOM Intelligence Function Library > Miscellaneous functions > IsOneOf
 
IsOneOf
Returns true if a value is equal to at least one of the other listed values.
Syntax
IsOneOf(<value> [, <value>, ...])
Parameters
<value>
Type: None
The value to test. Separate multiple values by using commas.
(return)
Type: Boolean
True if the first <value> is equal to one or more of the other values, otherwise False.
Notes
If <value> is NULL and at least one of the other values is NULL, the return value is True. If only one <value> is supplied, the return value is False.
In SQL statements, the IsOneOf function can be used in place of the IN operator, which is not supported by the UNICOM Intelligence Data Model.
Examples
Function call
Val1
Vals
Result
IsOneOf(Val1, Vals)
{4}
{7}, {3}, {4}, {8}
True
IsOneOf(Val1, Vals)
"song"
"Cuckoo", "song", "is", "summer", "song"
True
Val1.IsOneOf(Vals)
17.9
17, 17.4, 17.98
False
Val1.IsOneOf(Vals)
NULL
NULL, 0, 1, -1
True
The following example shows the use of the IsOneOf function in an SQL query, which will be executed against the Short Drinks sample data set provided with the UNICOM Intelligence Developer Documentation Library:
SELECT respondent.serial AS 'Serial', gender, occup
FROM vdata
WHERE occup.IsOneOf('sailor', 'doctor', 'soldier', 'postman')
Here is the result set:
Serial gender occup
====== ======== =======
100 {male} postman
115 {female} doctor
See also
Miscellaneous functions