This version is out of date, covering development from v9.5.0 to v9.7.3. It is maintained here only for inbound reference links from elsewhere. It is no longer actively updated.

Jump to the current version of aTbRef

Tinderbox v9 Icon

sum(scope, expressionStr)


Operator Type: 

Operator Scope of Action: 

Operator Purpose: 

Operator First Added: 

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]

 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().