This version is out of date, covering development from v9.0.0 to v9.3.0. 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

avg_if(group,condition,value)


Operator Type: 

Operator Scope of Action: 

Operator Purpose: 

Operator First Added: 

Operator Altered: 

 Function   [other Function type actions]

 Conditional Group   [operators of similar scope]

 Mathematical   [other Mathematical operators]

 Baseline

 


avg_if(group,condition,value)

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

group describes the notes to be examined and may be any group designator including a find() query.

condition is action code forming a valid conditional query test, i.e. it equates to true when matched. Some query-style operators terms may allow use of regular expressions.

value may be any valid expression, but will usually be a reference to an attribute; short form Boolean attribute expressions are acceptable.

For example:

$MyNumber = avg_if(children(/Catalog),$Price!=0,$Price); 

sets $MyNumber to the average price of all the items in Catalog, ignoring any items that have a price of 0.