ADD
Syntax
<add-expression> := 'ADD(' <Any> [ ',' { <Any>} ] ')'
Since
1.0
Return-type
Depends on the argument's type, see below
Description
The ADD-function adds (or concatenates) values of any type. The behavior and return-type of this function depends on the argument's type:
- If all arguments are Integers, the return-value is the sum of all values (the return type is Integer)
- If all arguments are Numbers, the return-value is the sum of all values (the return type is Double)
- If all arguments are Keys, the return value is the joined list of all Keys (the return type is Key)
- If all arguments are Strings, the return value is the concatenated String of all arguments (the return type is String)
- Otherwise the return-value is the concatenation of all values converted to String
NULL-values will be ignored (even when arguments contain NULLs, the function will return the sum or concatenation of all other values).
This function is not type-safe because it add anything and does no type-checks. Use the SUM-function to perform a pure number-addition (the SUM-function only accepts and returns values of the type Number).
Instead of the ADD-function you also can use the operators "+".
Examples
ADD( 10, 20 )
= 30
ADD( 'Hello', ' ', 'World' )
= 'Hello World'
ADD( 'Hello', 10 )
= 'Hello10'
ADD( Product:A, Product:B )
= Product:A | Product:B
See also
DIV, MUL, SUB, SUM
