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.
A report is composed of the following items:
- A report object
- A report dataset
- A report layout
- A request page
- Properties, triggers, and code
Lets try to create New AL report in in Microsoft Dynamics 365 Business Central
Installation guide: Install Microsoft Dynamics Business Central on premises 2019 Wave 2 Release
In VS Code create a new project, using the AL:Go command:
In your project, create a new file, for example: ItemListReport.al
In the ItemListReport.al file, use the treport snippet to create a report and then change the ID, Name and add fields and an option page, as in the following example:
In this example I’m using fields from the Item table to build the dataset for MyReport. I have also added a variable ShowUnitCost also added in the Request Page which can be used to display the unit cost in the report.
As I have defined the UsageCatagory as ReportandAnalysis we can directly search the report from the Search option in Business central web client. We have defined Layout as RDLC and specify the path in RDLCLayout.
Build the extension (Ctrl+Shift+B). The ItemListReport.rdl file will be created in the root of the current project.
Click on the ItemListReport.rdl and Right Click and Select Open Externally which will open the layout file in SQL Server Report Builder as below.
Add the columns from the Datasets folder into the table and save the .rdl file and add all the column in the Report layout. My Design Look like below.
SAVE and CLOSE the SQL Server Report Builder.
Back in Visual Studio Code, press Ctrl+F5 to compile and run the report in Dynamics 365 Business Central.
Search for AL ITEM LIST report and select Report, specify filter if required and run Report.
So we have created a RDL Layout Report in Microsoft Dynamics 365 Business Central.
To get new updates and learn about Microsoft Dynamics 365 Business Central Microsoft Learn
Thanks for reading.