sum_if

Computes the sum of a field if a criteria is met.

Example

1
{{ listWithValues | sum_if: 'fieldToSum', 'criteriaField', 'criteriaValue' }} => 4567

Input

Type Parameter Description Required
array data The array to sum the field from. Comes before the | sign. Required
string sumField The field to sum  
string criteriaField The field to use as the criteria  
mixed criteriaValue The value to use as the criteria  

Output

Type Description
mixed The sum of the field if the criteria is met