Transfooter and Transheader functionality in RDLC(SSRS) reports

Transfooter and Transheader functionality in RDLC(SSRS) reports

  • Comments 3

Please note that I have posted a new blog for this subject here. /Claus Lundstrøm

In our Classic reports we have the possibility to use Transfooter and Transheader. A typical use for classic Transfooters and Transheaders are to show a current subtotals up to the end of the current page or sums per page

These functions are not directly mapped from Classic reports to RDLC reports in Dynamics NAV 2009, but in this post I will go through how this is done in RDLC reports:

1. Create new report blank report with table 18

clip_image001

2. Create DataItem ”Customer”

clip_image002

3. Go to Section Designer and add the following fields:

· No.

· Name

· Debit Amount

clip_image003

4. Save the report as ID 50000 – Transfooter / Transheader

clip_image004

5. Now go to Visual Studio (View / Layout)

clip_image005

6. Create table and add the fields No, Name and Debit Amount

clip_image006

7. Give this table the name “MainTable”

clip_image007

8. Now we have added the basic for this report. But I would also like to have a Grand total of the Debit Amount so I add this as well. I add this in the Footer of the table

="GrandTotal: " & sum(Fields!Customer__Debit_Amount_.Value)

clip_image008

9. Now if my report is printed I get a list of my all my customer with Debit Amount displayed and with GrandTotal in the end of the report:

clip_image009

10. Now I would like to see the accumulated sum of the Debit Amount on each the page footers, and on the next page display this accumulated sum from previous page. So I will add Transfooter and Transheader functionality to the report.

11. First we need to do some intermediate calculations to accomplish this.

Add 3 new columns to the existing table in Visual Studio;

clip_image011

12. In the first column enter this expression:

=RunningValue(Fields!Customer__Debit_Amount_.Value, Sum, "MainTable")

And give this name “Subtotals1”

clip_image012

13. In the Second column enter this expression:

=RunningValue(Fields!Customer__Debit_Amount_.Value, Sum, "MainTable") - Fields!Customer__Debit_Amount_.Value

And give this name “Subtotals2”

clip_image013

14. In the Third column enter this expression:

=RunningValue(Fields!Customer__No__.Value, Count, "MainTable")

And give this name “SubCount”

clip_image014

The 3 columns should now look like this:

clip_image015

15. As these 3 columns are only used for calculation I will make them really small and set Visibility “Hidden=True” and make the font red so I remember that these columns are hidden.

Your report should now look like this:

clip_image016

16. Ok, it’s now time to add a Transfooter and Transheader. Enable Page Header and Page Footer in the report. You report should look like this:

clip_image018

17. In the Page Footer I place a text box with the following expression:

="Transfooter subtotal = " & Last(ReportItems!Subtotals1.Value)

And then I set BackgroundColor, and Color just so this Transfooter stands out in my report, and right align text:

clip_image019

clip_image020

18. In the Page header I place a text box with the following expression:

="Transheader subtotal = " & (First(ReportItems!Subtotals2.Value))

And then I set BackgroundColor, and Color just so this Transfooter stands out in my report, and right align text:

clip_image021

clip_image022

19. Now I’m almost done but I would like to not see the Transheader on the first page and not to see the Transfooter on the last page, so I select properties on the Page Header and set the “PrintOnFirstPage=False”

clip_image023

20. Now I could do the same on Page Footer, but maybe I would like to display the Page Footer, but not with the Transfooter displayed, so here is a little trick for how to do this.

21. Insert a text box below the table and set the expression to “=True”, Name=LastPageControl, Hidden=True and color red.

clip_image024

22. With this field added after the table we can now check to see when we are on the last page.

So I add the following Visibility Expression on the Transfooter textbox:

=ReportItems!LastPageControl.Value

clip_image025

23. Now I’m done, I save, import into NAV and compile. After some fit and finish on the report it now looks like this when I print:

clip_image027

clip_image029

You can download my report here as FOB and XPS.

Thanks,
Claus Lundstrøm, Program Manager, Microsoft Dynamics NAV

Attachment: Transheader-Transfooter.zip
Leave a Comment
  • Please add 1 and 2 and type the answer here:
  • Post
  • Please explain why you need the SubCount column with the expression: =RunningValue(Fields!Customer__No__.Value, Count, "MainTable")

  • This is fine unless you use BlankZero() function generated by Dynamics NAV reporting tool in RDLC. If the value is blank instead of zero. It show #error in that control.

    So my question is how to solve this problem.

    Please suggest!

    Thank you!

  • We have problem with empty space on the first page (reserved for the header, which is not printed). This is known bug. Have you different solution usable in case when the transheader is bigger than one line? (one line go through first page unnoticed, but header bigger will create visible empty space). This bug is not there when rendering to HTML...

Page 1 of 1 (3 items)