Caché MultiValue Basic Reference
[Home] [Back] [Next]
InterSystems: The power behind what matters   
Class Reference   

Returns whether each element in a dynamic array is numeric.
dynarray An expression that resolves to a dynamic array.
The NUMS function determines whether each element in a dynamic array is numeric or non-numeric. It returns a dynamic array of boolean values corresponding to the elements in dynarray. If an element contains a non-numeric value, NUMS returns 0 for that element. If an element contains a numeric value, NUMS returns 1 for that element. NUMS also returns 1 for the null string, or for a missing element value.
A numeric value can be a numeric or a string numeric. A valid numeric value can contain the numbers 0 through 9, plus and minus signs, and the decimal point; it cannot contain any other characters.
You can use the NUM function to determine whether a single value is numeric or non-numeric.
The following example uses the NUMS function to determine the numeric status of the elements of a dynamic array:
PRINT NUMS(a);  ! returns 1ý1ý1ý1ý1
The following example show how NUMS handles non-numeric strings, arithmetic expressions, and missing elements:
b="7dwarves":@VM:"dwarves7":@VM:@VM:(4+3):@VM:"hello world"
PRINT NUMS(b);  ! returns 0ý0ý1ý1ý0
See Also