sumIf



Function: sumIf()

Returns the sum of a set of numbers based on a series of corresponding true/false conditions.

Syntax

sumIf(numberList, conditionList)

ArgumentTypeDescription
numberListNumber ArrayAn Array containing a list of numeric values
conditionListCondition ListAn Array containing a list of PhixFlow expressions that must evaluate to true or false

Examples

Example 1

sumIf([1,1,1,1], [1,0,1,0])

returns 2.

Example 2

sumIf(in.Total, in.Include)

If this is applied to the 3 records from the in pipe (the following is pseudo-code used to represent a recordset):

{
	{Total = 32, Include = 1},
	{Total = 20, Include = 0},
	{Total = 15, Include = 1},
}

returns 47.

See Also