Saturday, January 7, 2017

How to Print Microsoft Dynamics NAV 2013 R2 RDLC Report Page Footer on Last Page Only

As we are all know there were two properties in NAV 2009 to print footer at bottom and on last page of report using PrintOnEveryPage and PlaceInBottom properties, but in RDLC report there are no such properties to achieve this.
In RDLC report we can use page footer to print footer at bottom of a report, but it prints on every page, because of these below two properties:
    1.  “Print on first page”: It prints page footer on every page except last page.
    2.  “Print on last page”: It prints page footer on every page except first page.
As I explained in above points we can use page footer to print footer at bottom of a page but it prints on every page, except very first or last page. So what is the way to print page footer at an end of a report? Here I explain how to achieve this using a simple method.
If we want to hide a text box from all pages except last page, set an expression to visibility property of the text box. The expression is to hide the text box in all pages except last page, therefore use the built-in fields to achieve this.
Expression and its syntax explained below:
=IIF(Expression, Yes, No);
   1.  Expression (1st parameter) = it’s a condition for hide, hide if current page is not last page (If current page is not equal to last page). IIF means “If and only if”.
   2.  Yes/True (2nd Parameter) = Hide if condition is true.
   3.  No/False (3rd Parameter) =Show if condition is true.
Here we are writing expression for not to hide if current page is equal to last page so the expression looks like this:
 ”=IIF(CurrPage=LastPage, Don’t hide, Else hide)”, So the expression is “=IIF(Globals!PageNumber=Globals!TotalPages, false, true)”.
What if two or more text boxes to hide? In this scenario place all text boxes inside a rectangle control and apply this visibility condition to the rectangle instead each text boxes.
Please have a look at below screenshot shows how to write above expression or how to hide text if current page is not the last one.


Figure 1: Shows how to hide text if current page is not the last.
If you wish to discuss regarding this RDLC Report Design blog, please feel free to drop me an email to dileepakb08@gmail.com

No comments:

Post a Comment