Sunday, March 31, 2013

Print totals on last page of report

Sometime we want a requirement to print Totals on very last page of Morphx report instead of each page footer, I saw different blog and most of them just answered to use element.pagesTotal() method and use it on executeSection() method of footer section. But the problem is that element.pagesTotals() always return 0 when you called it explicitly. To overcome this issue and display totals on very last page declare a variable "lastPageNumber" of type int on class declaration section, then set the value of lastPageNumber =; in fetch() method just before the element.reset(true); call. I am refering SalesConfirmation report. Then on your footer Total section executeSection method write following logic to restrict the section to last page.

if (lastPageNumber ==