For some reports, you may want to print a new page for each new record. In a Classic report layout, you use either the NewPagePerRecord property or the CurrReport.NEWPAGE property. In a client report definition (RDLC) report layout, the NewPagePerRecord property and the CurrReport.NEWPAGE property are not supported. To print a new page for each record in an RDLC report layout, you must do one of the following:

An example of a report that begins a new page for each new record is report 25, Account Schedule, in the standard application.

Before you begin this procedure, you must create a layout suggestion for the report. For more information, see How to: Create a Layout Suggestion.

To create a new page number variable to replace the CurrReport.NEWPAGE property

  1. In the Classic client, on the Tools menu, click Object Designer.

  2. In Object Designer, select Report, select the report in which you use the CurrReport.NEWPAGE property, and then click Design.

  3. On the View menu, click C/AL Globals.

  4. In the C/AL Globals window, on the Variables tab, add the following variables.

    Name DataType

    PageGroupNo

    Integer

    NextPageGroupNo

    Integer

  5. On the View menu, click C/AL Code.

  6. In the C/AL Editor, add the following code to the OnPreDataItem trigger to create and initialize the new page number variable.

      CopyCode imageCopy Code
    IF ISSERVICETIER THEN BEGIN
       PageGroupNo := 1;
       NextPageGroupNo := 1;
    END
    
  7. For each place in the code where you call the CurrReport.NEWPAGE property in the Classic client, add code to increment the PageGroupNo variable, as shown in the following example.

      CopyCode imageCopy Code
    IF ISSERVICETIER THEN BEGIN
       PageGroupNo += 1;
    END;
    
    NoteNote

    You cannot add the line of code to section triggers. If you use the CurrReport.NEWPAGE property in a section trigger, then you must add the line of code to increment the PageGroupNo variable to a DataItem trigger instead.

  8. On the View menu, click Sections.

  9. Add a text box where the SourceExpr value is PageGroupNo. Add another text box where the SourceExpr value is NextPageGroupNo. Set both text boxes to be hidden. For more information, see How to: Add and Identify Hidden Fields.

  10. Save and compile the report. For more information, see How to: Integrate Classic Client Report Designer and Visual Studio Report Designer.

To create a new page per record by grouping data

  1. In the Classic client, on the Tools menu, click Object Designer.

  2. In Object Designer, click Report, select the report that you want to modify to print a new page per record, and then click Design.

  3. If you performed the steps in the preceding procedure to create a new page number variable, or if the field on which you want to group already exists in a text box in the layout, then go directly to step 9. If you need to add the field on which you want to group to the layout, you must complete steps 4 through 8.

  4. On the View menu, click Sections.

  5. In Section Designer, create a text box for the field on which you want to group. Typically, you should create this text box in the body section where the record that you want to group by is placed.

  6. Right-click the text box that you created in step 4, and on the shortcut menu, click Properties.

  7. In the TextBox Properties window, set the Visible property to No.

  8. Close Section Designer.

  9. On the View menu, click Layout.

  10. In Microsoft Visual Studio, in the Report.rdlc file, select the text box for the field on which you want to group.

  11. On the View menu, click Properties Window.

  12. In the Properties window, under Visibility, set Hidden to True.

  13. In the table data region of the layout, right-click the data row that you want to group, and then click Insert Group.

  14. In the Grouping and Sorting Properties window, under Group on, select a line to add an expression. From the drop-down list, select the field on which you want to group.

  15. Clear the Include group footer check box.

  16. Select the Page break at end check box, and then click OK.

  17. Select the data row to which you added the grouping.

  18. In the Properties window, under Visibility, set Hidden to True.

  19. Save and compile the report. For more information, see How to: Integrate Classic Client Report Designer and Visual Studio Report Designer.

See Also