Reports in Dynamics 365 Business Central, is a document that presents information in an organized format. Reports are used to print or display information from database, for example-Sales Invoices. It provides information on various aspects of business and is easy and efficient and play a major role in streamlining the progress of business.
So how to develop a report?
Create a report object and design a dataset, Datasets decide which record from the Dynamic 365 Business Central database used to generate report output.
Types of Report Layouts:
Word Layout
Report Definition Language (RDL) Layout
Excel Layout
Request Page:
Request page runs before the report starts to execute, which in turn allows the end-user to specify filters for a report.
Types of Report:
Simple list report
Grouping list report
Document report
Document with Header/Footer report
Process only report
Chart report
Fixed format report or Pre-printed report
Barcode and QR code report
Report Triggers:
OnInitreport: This trigger runs before the request page in addition it initialize the global variable.
OnPreReport: This trigger runs after the execution of request page before the report runs.
OnPostReport: This trigger runs after all the data item processed, in a simple way that this trigger runs at last.
DataItem Triggers:
OnPreDataItem: This trigger filters the value before the dataitem is processed.
OnAfterGetRecord: For each and every record this will trigger, until reaches to the final record this trigger will run multiple times.
OnPostDataItem: This trigger run after the last record in data item but before the OnPostReport.
SetData and GetData: To change the Header information according to the body part SetData and GetData is used.
Steps:
Change the Code in Report Properties
Create List
Inside list insert new table
Right click one of the textbox under visibility section show or hide add SetData code
Ex: Code.SetData(Cstr(Field!field_name.Value), 1)
Here 1 indicates first group
In the Header Section inside the textbox write GetData by passing parameters under the Expression section.
Ex: Code.GetData(1,1)
Here first number indicates the filed value, and second number indicates the group value.