The AL developer environment is evolving with frequent updates. To stay up to date on the latest information and announcements, follow us on the Dynamics NAV Team Blog.

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.

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).

  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