Wednesday, December 15, 2010

Add Page Breaks Conditionally

Sometimes after developing a report you may have a requirement to conditionally add a page break after or before each logical portion of the report. Some users may need to see all of the logical units in consecutive pages and some prefer to see each logical unit in its own page.

Here is a simple trick to conditionally add the page break. Two simple steps:


  • Put your data control(s) that you'd like to conditionally paginate within a list control.










  • Edit the Detail Group of the list control and set the Group Expression to a condition a statement that uses a parameter or some other flag to determine whether to group the list based on a variable or a constant. Here is an example: =Iif(Parameters!PageBreak.Value, Fields!ProductID.Value,"")
  • Make sure you check the "Add page break at end" in the Grouping and Sorting Properties dialog box of the enclosing list dialog; see screen shot below.



Hope this helps.

No comments:

Post a Comment