Search This Blog

Tuesday, 22 January 2013

Brought Forward/Carried Forward Totals In XML


Brought Forward/Carried Forward Totals

Many reports require that a page total be maintained throughout the report output and be displayed at the beginning and end of each page. These totals are known as "brought forward/carried forward" totals.
Note: The totaling for the brought forward and carried forward fields is performed in the PDF-formatting layer. Therefore this feature is not available for other outputs types: HTML, RTF, Excel.
An example is displayed in the following figure:
At the end of the first page, the page total for the Amount element is displayed as the Carried Forward total. At the top of the second page, this value is displayed as the Brought Forward total from the previous page. At the bottom of the second page, the brought forward value plus the total for that page is calculated and displayed as the new Carried Forward value, and this continues throughout the report.

Assume you have the following XML:
The following sample template creates the invoice table and declares a placeholder that will hold your page total:







To display the brought forward total at the top of each page (except the first), use the following syntax:
The following table describes the elements comprising the brought forward syntax:
Insert the brought forward object at the top of the template where you want the brought forward total to display. If you place it in the body of the template, you can insert the syntax in a form field.
Place the carried forward object at the bottom of your template where you want the total to display. The carried forward object for our example is as follows:


Note the following differences with the brought-forward object:
·         The display-condition is set to exceptlast so that the carried forward total will display on every page except the last page.
·         The display string is "Carried Forward".
·         The show-carry-forward element is used to show the carried forward value. It has the same properties as brought-carried-forward, described above.

You are not limited to a single value in your template, you can create multiple brought forward/carried forward objects in your template pointing to various numeric elements in your data.

No comments:

Post a Comment