RLDR is a technical demonstration project that highlights the use of dynamic structures in RDL reports. This project demonstrates how to efficiently manage complex workflows using dynamic structures in RDLC reports.
Features
- Implementation of dynamic structures in RDL reports.
- Efficient management of data and complex workflows.
- Compatible with application platform version 21.0.0.0 and higher.
- Includes support for debugging and source code download.
For more information, consult the documentation.
Implementation
Prerequisites
- Download the latest RLDR package.
- Upload and install the downloaded package to Business Central.
- Declare a new dependency for the RLDR package in your project.
- Download symbols for the new package.
1. Copy the default layout
- From Business Central, access the
Report Layouts (9660, List)
page. - Select any of the
RLDR (Report)
report from the list 1, 2. - Click the
Export Layout
button in the action bar at the top. - Save the file to the desired location.
2. Assign the layout to the report
Configure the RDLCLayout
property of your report with the path of the exported layout.
3. Define the RLDR
column and configure the main dataitem
Set the PrintOnlyIfDetail
property of the main dataitem to true
. This ensures that the report only prints when there are details to show.
Add the following column to the main dataitem
of the report:
column(RLDR; RecordId) { }
This is necessary to maintain organized report elements.
4. Add an auxiliary dataitem
(_
) to the report
Add the following code block into the report to define the additional dataitem 3:
dataitem(_; RLDR)
{
column(Number; Number) { }
trigger OnPreDataItem()
begin
Use(PageHeight, DataCount, StaticHeight, DynamicHeight, BlankLineHeight);
end;
}
Replace PageHeight, DataCount, StaticHeight, DynamicHeight, and LineHeight with the actual values or variables that you want to use for the report parameters.
Note
TheUse
method is defined in theRLDR
table 4 and is used to set the parameters for the report.
See examples below for how to use the Use
method effectively.
4.1 Example using one line for simplicity.
The following example demonstrates how to setup the Use
method with a single line of code for simplicity and efficiency:
trigger OnPreDataItem()
begin
SetParams(11.69, 2.00 + Line.Count() * 0.25 + Subtotal.Count() * 0.25, 1.69, 0.25);
end;
4.2 Example using inline values for clarity.
The following example demonstrates how to use inline values for better readability and maintainability of the code without the need for additional variables:
trigger OnPreDataItem()
begin
SetParams(11.69,
1.00 + Line.Count() * 0.25 + Subtotal.Count() * 0.25 + 0.75 + 0.25,
0.44 + 1.00 + 0.25,
0.25);
end;
4.3 Example using named variables for readability.
The following example demonstrates how to use named variables for better readability and maintainability of the code:
trigger OnPreDataItem()
var
PageHeight: Decimal;
StaticHeaderHeight: Decimal;
DataHeight: Decimal;
SubtotalHeight: Decimal;
TotalizationHeight: Decimal;
FootnoteHeight: Decimal;
StaticHeight: Decimal;
TableHeaderHeight: Decimal;
DynamicFooterHeight: Decimal;
FooterHeight: Decimal;
DynamicHeight: Decimal;
LineHeight: Decimal;
begin
PageHeight := 11.69;
StaticHeaderHeight := 1.00;
DataHeight := Line.Count() * 0.25;
SubtotalHeight := Subtotal.Count() * 0.25;
TotalizationHeight := 0.75;
FootnoteHeight := 0.25;
StaticHeight := StaticHeaderHeight + DataHeight + SubtotalHeight + TotalizationHeight + FootnoteHeight;
TableHeaderHeight := 0.44;
DynamicFooterHeight := 1.00;
FooterHeight := 0.25;
DynamicHeight := TableHeaderHeight + DynamicFooterHeight + FooterHeight;
LineHeight := 0.25;
SetParams(PageHeight, StaticHeight, DynamicHeight, LineHeight);
end;
6. Execute the report
With minimal adjustments, run the report without filters and verify that the result meets expectations. Otherwise, you may need to make adjustments to the parameters or structure of your report.
7. Customize the layout
If the report has executed successfully, you can begin adding the necessary columns and logic to complete the dataset, as well as customize the layout.
Additional Information
- Publisher: Alejandro J de Tena
- Version: 2.1.0.0
- Platform: 21.0.0.0
- Application: 21.0.0.0
Notes
1: The RLDR extension must be installed.
2: There are different layout designs for different report templates. Choose the one that fit your requirements better.
3: Requires a dependency for the RLDR package.
4: See Table RLDR.