Scripting > 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(Val1 [, Vals, ...])
Parameters
Val1
Type: None
The value to test.
Vals
Type: None
Variable number of other values.
(return)
Type: Boolean
True if Val1 is equal to one or more of Vals, otherwise False.
Remarks
If Val1 is NULL and at least one of Vals is NULL, the return value is True. If Vals is not 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