Creation of Reports using AL Extension in Microsoft Dynamcis NAV Development Preview
Introduction:
This blog demonstrates the creation of Reports through extensions in Microsoft Dynamics NAV Development Preview Environment(Microsoft Dynamics 365 for Financials and Operation, Business Edition).
Pre-requisite:
- Microsoft Dynamics NAV Development Preview Environment
- Visual Studio Code with AL Extensions
Demonstration:
1. Creating a Report using AL extensions.
report 50100 MyReport { UsageCategory = ReportsAndAnalysis; ApplicationArea = All; CaptionML = ENU = 'MyCustomerList'; RDLCLayout = 'ReportLayouts/MyReport.rdl'; // WordLayout='ReportLayouts/MyReportWord.docx'; // DefaultLayout=Word; dataset { dataitem(DataItemName; Customer) { column(CustomerName; Name) { } column(CustomerNumber; "No.") { } } } requestpage { layout { area(content) { group(GroupName) { field(HideDetails; HideDetails) { } } } } actions { area(processing) { action(ActionName) { } } } } var HideDetails: Boolean; }
2. Creating a Page Action to run the Report using AL extensions.
pageextension 50100 MyExtension extends "Customer List" { layout{ } actions { // Add changes to page actions here addlast("&Customer") { action(ShowMyReport) { ApplicationArea = All; trigger OnAction(); begin clear(myReport); myReport.Run; end; } } } var MyReport : Report MyReport; }
3. Installing the extension and executing the Report, the results are blank as the Layout for the Report is not set.
4. To create the layout, search for ‘Report Layout Selection’.
5. Then select the report added through the extensions and Export the template.
6. Open the RDL Export file in SSRS or Visual Studio and add the relevant fields or tables.
7. In the Visual Studio Code add the following lines of code.
RDLCLayout=<PATH of RDL File>; UsageCategory = ReportsAndAnalysis; ApplicationArea = All;
8. Viewing the Report
Conclusion:
Thus according to the NAV 2018, the report when created in C/SIDE automatically has an RDL file associated with it. But when creating reports through extensions separately the layout needs to be created.