Changes

,  08:16, 16 March 2019
no edit summary
Line 31: Line 31:

Access to the value of an attribute in a Calculation field is performed using the symbol ? (question mark):
+
Access to the value of an attribute in a Calculation field is performed using the colon (:):
+

==== For example, to access the Count attribute, use the following syntax ====

==== For example, to access the Count attribute, use the following syntax ====

* #{items?count}

* #{items?count}

If the field contains several links to entries, then you can use the index to access the attribute:

If the field contains several links to entries, then you can use the index to access the attribute:
* #{items@0?count}, #{items@1?count}
+
* #{items@0:count}, #{items@1:count}

=== Aggregation of attributes in a Calculation field ===

=== Aggregation of attributes in a Calculation field ===

If the Link to Entry field contains several linked entries and each of them has its own attribute value, then one of the aggregation functions can be applied to these attributes. For example, to calculate the sum of all the attributes:

If the Link to Entry field contains several linked entries and each of them has its own attribute value, then one of the aggregation functions can be applied to these attributes. For example, to calculate the sum of all the attributes:
+

Aggregation functions support pairwise operations between different fields of linked entries and attributes:

Aggregation functions support pairwise operations between different fields of linked entries and attributes:

// This function multiplies the linked_field_name field of each associated entry by the corresponding attribute_name attribute.

// This function multiplies the linked_field_name field of each associated entry by the corresponding attribute_name attribute.

// The set of numbers obtained after multiplication is summed.

// The set of numbers obtained after multiplication is summed.
+

For example, to calculate the total amount of an order, you can use the formula:

For example, to calculate the total amount of an order, you can use the formula:

// This formula multiplies the value of the price field of the linked entry in pairs by the value of the attribute count of the linked entry.

// This formula multiplies the value of the price field of the linked entry in pairs by the value of the attribute count of the linked entry.

// The set of numbers obtained after multiplication is summed.

// The set of numbers obtained after multiplication is summed.
\$sum('items.price', 'items?count', '@mul');
+
\$sum('items.price', 'items:count', '@mul');