sum_if(group,condition,value)

Tinderbox Icon


Operator Type:   Function
Operator Scope of Action:   Conditional Group
Operator Purpose:   Mathematical

sum_if(group,condition,value)

This computes the sum of every value in a group, as filtered by a condition expression. See sum() for a related non-conditional operator.

group may be any of {children,descendants,siblings,ancestors,all}.

In addition, where may be argument that designates a particular (single) note other than this.

condition is a valid conditional test - i.e. it equates to true when matched.

value can be any expression, but is typically an attribute value. It can also be the number 1, i.e. if the test is true from that item then add one to the count.

For example,

sum_if(children,$Prototype=="p_Problem",1) 

sums the number of children of the current note whose prototype is 'p_Prototype'. If tested value is a string with spaces, e.g. "p Prototype" vs. "p_Prototype" then use double quotes around the value.


Possible relevant notes (via "Similar Notes" feature):

Up: Full Operator List
Previous: sum(group, value)  Next: tan(argument) 

A Tinderbox Reference File : Actions & Rules : Operators : Full Operator List : sum_if(group,condition,value)

Quicklinks: Attributes | Action Codes | Export Codes | Designators | Date Formats | aTbRef Site Map

[Last updated: 16 May 2012, using v5.11.1]


Search:

Google search aTbRef for:  


Creative Commons Licence

aTbRef by Mark Anderson is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.

[See aTbRef CC licence Attribution & Waiver info]

Made with Tinderbox