Add¶
Adds all values given to the rule.
If no parameters are provided, all available inputs are added. Each parameter
can be either a field reference or a static numeric value. The output type is
promoted from the inputs: INT if all inputs are integers, FLOAT if any
input is a float, and DATE if any input is a date. Date inputs are added as
seconds, so Add(:date, 86400) advances :date by one day.
Parameters¶
- N —
addendsOptional — accepts: field, INT, FLOAT -
The Nth addend. May be a field reference (
:f) or a static numeric literal. If no parameters are given, all available inputs are summed.
Input type¶
INTFLOATDATE
Output type¶
matches-input-promotion
Returns DATE if any input is a date, FLOAT if any input is a float, otherwise INT.
Requires¶
- Only one date can be given in the input.
- A date cannot be added to a float.
- If a float is in the input the return type will always be a float.
- If a date is in the input, the return type will always be a date.
Examples¶
Sum all available inputs
Static values
Mix of fields and constants (promotes to FLOAT)
Date arithmetic — advance a DATE by an INT number of seconds
Errors¶
-
An unsupported type was being added to an integer or date addition- A
STRINGorBOOLEANvalue reached the rule. OnlyINT,FLOAT, andDATEare accepted.
-
Add cannot add multiple dates- Two or more
DATEinputs were supplied. Only one date is permitted perAdd.
-
Add cannot add a date and a float- A
DATEinput was combined with aFLOAT. Cast the float to int first.