Caché MultiValue Basic Reference
Subtracts the values of corresponding elements in two dynamic arrays.
||The minuend. An expression that resolves to a dynamic array of numeric values. If a dynamic array element contains a non-numeric value, SUBS treats this value as 0 (zero).
||The subtrahend. An expression that resolves to a dynamic array of numeric values. If a dynamic array element contains a non-numeric value, SUBS treats this value as 0 (zero).
function subtracts the value of each element in dynarray2
from the corresponding element in dynarray1
. It then returns a dynamic array containing the results of these subtractions. If an element value is missing, or is the null string or a non-numeric value, SUBS
parses its value as 0 (zero).
If the two dynamic arrays have different numbers of elements, the returned dynamic array has the number of elements of the longer dynamic array. By default, the shorter dynamic array is padded with 0 value elements for the purpose of the arithmetic operation. You can also use the REUSE
function to define behavior when specifying two dynamic arrays with different numbers of elements.
You can use the ADDS
(modulo division), and PWRS
(exponentiation) functions to perform other arithmetic operations on the corresponding elements of two dynamic arrays.
The following example uses the SUBS
function to subtract the elements of two dynamic arrays:
! returns 1ý13ý25ý37
The following example subtracts elements of dynamic arrays of differing lengths:
! returns 9ý20ý31ý42ý-2ý-2