ConditionalSum
This function returns sum of values from specified columns/fields in specified table/attachment for fields that satisify specified condition. If specified field/column does not contain numeric values or does not satisfy condition, it is not added to result.
Syntax
Sum("source","fieldName","conditionalFieldName","conditionalValue");
Function arguments
- source – (String) The source of data containing values to be summed. This can be table name (i.e. 'Invoices’), nested table name (i.e. 'Finances>Invoices’) or an attachment template file name.
- fieldName – (String) The name of the column/field containing decimal values to be summed.
- conditionalFieldName – (String) The name of the column/field containing value to be tested as condition.
- conditionalValue – (String) The value that conditional field value has to be equal to in order to satisfy condition
Return value
This function returns Decimal.
Returns the sum of numerical values from specified column/field in specified table/attachment that satisfy specified conditon.
Examples
Example 1:
This will return sum of values of fields from 'column3′ in 'table1′ which 'column4′ value is equal to 'some value’.
Sum("table1", "column3", "column4", "some value");