Caché MultiValue Basic Reference

 Server:docs2 Instance:LATEST User:UnknownUser

 [ Home ]  >  [ MultiValue Features of Caché ]  >  [ Caché MultiValue Basic Reference ]  >  [ Caché MultiValue Basic Functions ]  >  [ ADDS ] Go to: Description Examples See Also Search:

Adds the values of corresponding elements in two dynamic arrays.
Synopsis
Arguments
 dynarray An expression that resolves to a dynamic array of numeric values.
Description
The ADDS function adds the value of each element in dynarray1 to the corresponding element in dynarray2. It then returns a dynamic array containing the results of these additions. If a dynarray element value is a null string, missing, or a non-numeric value, ADDS 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 NUMS function to determine if the elements in a dynamic array are numeric. You can use the SUBS (subtraction), MULS (multiplication), DIVS or DIVSZ (division), MODS (modulo division), and PWRS (exponentiation) functions to perform other arithmetic operations on the corresponding elements of two dynamic arrays.
To add together the element values within a single dynamic array, use either the SUM function (for single-level dynamic arrays) or the SUMMATION function (for multi-level dynamic arrays),
Examples
The following example uses the ADDS function to add the elements of two dynamic arrays:
a=11:@VM:22:@VM:33:@VM:44
b=10:@VM:9:@VM:8:@VM:7
PRINT a;          ! returns 11ý22ý33ý44