Operator Type:
Operator Scope of Action:
Operator Purpose:
Operator First Added:
Operator in Current Baseline:
Operator Last Altered:
Operator Uses Scoped Arguments:
Operator Has Newer Dot-Operator Variant:
Function [other Function type actions]
Group [operators of similar scope]
Mathematical [other Mathematical operators]
v4.0.0
Baseline
As at baseline
[More on scoped arguments in Action Code]
Yes
sum(scope, expressionStr)
This computes the arithmetic Number of every expressionStr value in each in-scope item (defining scope). See sum_if() for a related conditional operator.
The sum() operator omits notes for which $Searchable is false
.
expressionStr can be an expression, but is typically a Number-attribute value or a List/Set holding a list of numbers. It can also be a literal number 1, i.e. if the test is true
from that item then add one to the retuned value of sum(). The latter is less likely than with the sibling operator sum_if().
For example,
$MyNumber = sum(children,$WordCount);
constructs the current word count of the children of the note.
See also List/Set.sum().