Total Block
You can add a <total_block>
tag to an <output_list>
tag. This allows you to prevent automatic currency conversion to the corporate currency. You use the <ol_aggr_field>
sub tag to carry out calculations such as sum, min, max, cnt and avg. The result of a <total_block>
tag is shown after the last row of data in the <output_list>
tag to which it belongs, but before the <after>
tag.
Syntax:
<total_block>
<ol_aggr_field name="FieldNameToCalc
" aggregate_function="Calculation
" format=""NumberFormat"
/>
<ol_aggr_field name="FieldNameToCalc
" aggregate_function="Calculation
" format=""NumberFormat"
" />
</total_block>
If your template contains a <total_block>
tag, that tag must contain at least one <ol_aggr_field>
tag. The <ol_aggr_field>
tag determines the fields that appear in the output. Where:
FieldNameToCalc
is the API name of a field to include in the total block.Calculation
is the calculation to be carried out on the field data. You can enter any of the following: sum, min, max, cnt, avg.- Number Format is the way in which the result of the calculation is to be formatted.
Sample Code
<output_list object="Contact" relation="AccountId">
<before_block>
<table>
<tr>
<th>Name</th>
<th>Social Rank</th>
</tr>
</before_block>
<ol_field name=”Name”/>
<ol_field name="Social_Ranking__c" format="decimals:1;"/>
<total_block>
<tr>
<td>Avg</td>
<td><ol_aggr_field name="Social_Ranking__c" aggregate_function="avg" format="decimals:1;"/></td>
</tr>
<tr>
<td>Sum</td>
<td><ol_aggr_field name="Social_Ranking__c" aggregate_function="sum" format="decimals:1;"/></td>
</tr>
<tr>
<td>Count</td>
<td><ol_aggr_field name="Social_Ranking__c" aggregate_function="cnt" format="decimals:0;"/></td>
</tr>
<tr>
<td>Min</td>
<td><ol_aggr_field name="Social_Ranking__c" aggregate_function="min" format="decimals:1;"/></td>
</tr>
<tr>
<td>Max</td>
<td><ol_aggr_field name="Social_Ranking__c" aggregate_function="max" format="decimals:1;"/></td>
</tr>
</total_block>
<after_block></table></after_block>
</output_list>