Calculation field: Difference between revisions

Jump to navigation Jump to search
m
no edit summary
mNo edit summary
mNo edit summary
Line 357: Line 357:
#{item@avg.price}
#{item@avg.price}
</source>
</source>
== Aggregation functions in Calculation fields ==
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.
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.
// 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.
=====
Function Arguments Returns
$ sum fields, operation (optional, used if multiple fields are specified)
fields - the path to the field or attribute of the associated record in the format: 'link_field_name.linked_field_name'
where link field name is the name of a link to an entry field.
This function returns the sum of values ​​of the field.
In the function, you can pass the paths to several fields (attributes), in this case, before pairing, pairwise operations between fields (attributes) will be performed. The type of pairwise operation is determined by the last argument of the operation function and can be:
'@mul' - multiplication of fields (attributes).
'@add' - addition of fields (attributes).
'@sub' - subtraction of fields (attributes) from the field specified first.
'@div' is the division of the fields (attributes) into the field specified first.
The operation argument is optional, if it is not specified, then the multiplication operation is used
$ avg fields, operation This function returns the average value of a field.
$ min fields, operation This function returns the minimum of values ​​of the field.
$ max fields, operation This function returns the maximum of the values ​​of the field.


{{FieldNameHint}}
{{FieldNameHint}}

Navigation menu