Write, Bureaucrats, Administrators
4,332
edits
mNo edit summary |
mNo edit summary |
||
Line 360: | Line 360: | ||
== Aggregation functions in Calculation fields == | == Aggregation functions in Calculation fields == | ||
Aggregation functions are used to process multiple values of fields of linked entries and return one value. | Aggregation functions are used to process multiple values of fields of linked entries and return one value. | ||
$sum('link_field_name.linked_field_name') // This function returns the sum of values of the field called link_field_name for all entries included in link_field_name. | * $sum('link_field_name.linked_field_name') // This function returns the sum of values of the field called link_field_name for all entries included in link_field_name. | ||
Aggregation functions can be used with multiple field of a linked entry. In this case, a pairing operation is specified, which will be applied to the fields before the main aggregation function is applied. | Aggregation functions can be used with multiple field of a linked entry. In this case, a pairing operation is specified, which will be applied to the fields before the main aggregation function is applied. | ||
$sum('link_field_name.field1', 'link_field_name.field2', '@mul') // This function first multiplies the field1 and field2 fields of the linked entry of the link_field_name field. | * $sum('link_field_name.field1', 'link_field_name.field2', '@mul') // This function first multiplies the field1 and field2 fields of the linked entry of the link_field_name field. | ||
// After that the resulting set of numbers is summed. The pairwise operation, in this case, is multiplication: '@mul' | // After that the resulting set of numbers is summed. The pairwise operation, in this case, is multiplication: '@mul' | ||
Note that the function parameters are specified in single quotes. | Note that the function parameters are specified in single quotes. | ||
===== | ===== | ||
Function Arguments Returns | Function Arguments Returns |