Conditional Page break in RTC Reports

  2 minute read

In this post I will try to explain how to dynamically control the page break for a group or in other words how to create a conditional page break in the NAV 2013 RTC report.

For this post I will use the standard report 5057 (Salesperson – To-do’s), this report is already grouped by salesperson but now we will add the option to page break (New Page per Salesperson).

  1. Open report 5057 in design mode and declare a new global variable *NewPagePerSalesPerson (Boolean) *which we will use in the request page
    *

  2. Now we will add the option in the request page of the report for the user to choose page break, for that choose View à Request Page and add the variable as show in the below fig. clip_image004

  3. Add the variable NewPagePerSalesPerson* to the report dataset and name it as PageBreakPerSalesPerson.
    *

  4. Now open the report in layout mode by choosing View à Layout, notice the report already has a group which is grouped on Salesperson field
    clip_image008

Currently this group is not enabled for page breaks, but if you enable page break it will use new page per salesperson every time you run the report but we want to control that based on the value in the options window.
clip_image010

  1. To enable page break based on the value in the options windows of the report, add a new a outmost group for the current group by right clicking on the Table1_Group and Choose Add Group à Parent Group
    clip_image012

In Group Window open the expression editor by clicking Fx and leave other properties to their defaults
clip_image014

Add the following expression =IIF(Fields!PageBreakPerSalesPerson.Value,Fields!To_do__Salesperson_Code_.Value,Nothing) clip_image016

Click OK.

  1. A new column is added to the table select the column and delete the column, and from the confirmation dialog choose Delete Columns only.
    clip_image018

clip_image020

  1. From the newly added group, right click and select Group properties

[clip_image022](http://lh3.ggpht.com/-dehN14Qc6B4/VKNdS59APQI/AAAAAAAAIZE/R4GBjj1ovTA/s1600-h/clip_image022%25255B3%25255D.jpg)

In the Page Breaks, select Between each instance of a group*.

[clip_image024](http://lh3.ggpht.com/-z4jiP_BaBYo/VKNdUznQLII/AAAAAAAAIZU/9zh_9P1Oj1U/s1600-h/clip_image024%25255B3%25255D.jpg) Now if you run the report with option selected New Page Per Salesperson it will create a page break for every salesperson. [clip_image026](http://lh6.ggpht.com/-eWD_Cc1AkVY/VKNdWLNSORI/AAAAAAAAIZg/1LK2Y9Lk9OQ/s1600-h/clip_image026%25255B3%25255D.jpg) [clip_image028](http://lh6.ggpht.com/-_G-JvQCz5BE/VKNdXyvH_BI/AAAAAAAAIZ0/AQYS4cwjN7A/s1600-h/clip_image028%25255B3%25255D.jpg) There are some other standard reports like 108 - Customer - Order Detail, which has similar options and logic but instead of using an expression for a group it uses a variable value. Please leave your comments, feedback or any suggestions you have for me to improve me my blog and also if you have any questions, feel free to post .

Leave a comment