In some report scenarios, it is useful to include a page-scoped aggregate in Page Header or Page Footer section. As of Q1 2011, the powerful expression engine of Telerik Reporting has been extended with page aggregates, which allow you to add customizable sub-totals and summary data at the bottom of every page, such as total number of Unit X sold, or the average number of processes that have passed. You can add counts, sums, and averages to each page, even if your report consists of subreports and several tables.

To add a page aggregate you need to utilize the new PageExec function that takes two parameters:
  • itemName – determines which data objects are included in the page exec accumulation. For each instance of the report item with the specified name that occurs on the current page, its data object is accumulated.That’s why the items that are used as scope should have unique names.
  • aggregateFunction – the aggregate that is accumulated for each page. The expression used as argument of the aggregate function is evaluated against the collected data objects.

How to use page totals?

Page aggregate on detail data:
used in Page Header or Page Footer section will return the LineTotal summary for every single page of the report. The "lineTotalTextBox" string is the Name of a TextBox located in Report’s Detail section/ Subreport ‘s Detail Section/ Table, List, Crosstab body and is bind to a DataObject which contains the referred field.

Page aggregate on summary (aggregated) data:
If the report item is located in Group Header, Group Footer sections, and Table groups the PageExec will work over the entire raw data that is bound to the group members. For example if certain group member is rendered on two pages the PageExec will work on the group member’s data no matter if it’s rendered on two or more pages. This is done to make sure that the data will be correctly calculated over the groups and no partial group member’s data is used in the aggregates.

Invoice demo 2

If you need a PageExec only for the data on the page then you should use a report item located in a detail section or detail group.

The PageExec is evaluated only on the pages that have rendered the used report item. So if for any reason the used report item is not rendered on certain page the PageExec will not evaluate on that page.

It’s important to note that there is no obligation to use the same aggregate in the PageExec as the one used in the group’s report item. For instance in the groups report item you can calculate Sum but in the PageExec you can calculate Avg. This is possible because the PageExec is working on the DataObject instead over the report item values.

Just to note that we have made some additional tuning and improvements to the Page Aggregates in Internal Build Thus our suggestion is to download and install the latest internal build if you intent to use the Page Aggregates.

About the Author

Stefan Tsokev

Stefan’s main interests outside the .NET domain include rock music, playing the guitar and swimming.

Related Posts


Comments are disabled in preview mode.