Creating an RDL Layout Report

When you create a new report for Dynamics 365 Business Central, there are two things you have to think about; defining the report dataset of data items and columns, and then designing the report layout. These steps will show you how to create a very simple report based on an RDL layout. For more information about the report object, see Report Object.

Important

RDL layouts can result in slower performance with document reports, regarding actions that are related to the user interface (for example. like sending emails) compared to Word layouts. When developing layouts for document reports, we recommend that you design Word layouts instead of RDL. With Word layouts, reports are not impacted by the security constraints on sandbox appdomains like they are with RDL layouts. From a service perspective, RDL layouts are not trusted, so they will run in a sandbox appdomain that only lives for the current report invocation.

To create and modify RDL report layouts, you use SQL Server Report Builder or Visual Studio Report Designer. For information about required versions of these tools, see System Requirements.

Create an RDL layout report

To facilitate testing your report layout, the following example extends the Customer List page with a trigger that runs the report as soon as the Customer List page is opened.

  1. Create a new extension to the Customer List page that contains code to run the report, as well as a simple report object by adding the following lines of code:

    pageextension 50123 MyExtension extends "Customer List"
    {
        trigger OnOpenPage();
        begin
            report.Run(Report::MyRdlReport);
        end;
    }
    
    report 50123 MyRdlReport
    {
        DefaultLayout = RDLC;
        RDLCLayout = 'MyRDLCReport.rdl';
    
    }
    
  2. Build the extension (Ctrl+Shift+B) to generate the MyRDLCReport.rdl file.

  3. Add the Customer table as the data item and the Name field as a column to the report by adding the following lines of code:

    dataset
    {
        dataitem(Customer; Customer)
        {
            column(Name; Name)
            {
            }
        }
    }   
    
    
  4. Build the extension (Ctrl+Shift+B). The file will be created in the root of the current project.

  5. Open the generated report layout file in Microsoft SQL Server Report Builder.

  6. Edit the layout by inserting a table.

  7. Add the Name column from the datasets folder into the table and save the file.

  8. Back in Visual Studio Code, press Shift+F5 to compile and run the report.

You will now see the generated report in preview mode.

See Also

Report Object
Creating a Word Layout Report