Calculation field: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 46: Line 46:
== Link to entry ==
== Link to entry ==
Use the following syntax to get access to the values of entry fields like Link to entry:
Use the following syntax to get access to the values of entry fields like Link to entry:
<source lang="java">
<source lang="java">#{field_name.child_field_name}</source>
#{field_name.child_field_name}
where ''field_name'' – name of field like Link to the entry, ''child_field_name'' – name of one field of a related entry.
</source>
where field_name – name of field like Link to the entry, child_field_name – name of one field of a related entry.


If a field like Link to the entry contains several links, then use index (starts from zero) to get access to them:
If a field like Link to the entry contains several links, then use index (starts from zero) to get access to them:
<source lang="java">
<source lang="java">#{field_name@0.child_field_name}, #{field_name@1.child_field_name}, … </source>
#{field_name@0.child_field_name}, #{field_name@1.child_field_name}, …  
</source>


You can specify one of the supported aggregation functions instead of the index:
You can specify one of the supported aggregation functions instead of the index:
#{field_name@sum.child_field_name} returns the sum of values of field child_field_name for all entries included into field_name.
<source lang="java">#{field_name@sum.child_field_name}</source>
In addition, the following functions are supported: avg, min, max.
This expression returns the sum of values of field child_field_name for all entries included into field_name. In addition, the following functions are supported: avg, min, max.<br />
#{field_name@size} – returns the number of entries in field field_name.
Returns the number of entries in field field_name:
<source lang="java">#{field_name@size}</source>

Navigation menu