Flexible Line Display in Purchase Order Report – Business Central RDLC Layout
When working on report customizations in Microsoft Dynamics 365 Business Central, one common challenge is maintaining a consistent layout regardless of how many lines are present in the data source.
This situation often arises in reports like Purchase Orders, Sales Orders, or Invoices, where the line section expands or contracts based on the number of lines in the dataset. However, certain business scenarios demand a fixed or uniform presentation, such as when a client wants consistent spacing or placeholders for manual inputs.
This article demonstrates how you can achieve this flexibility purely through RDLC layout design – without making any changes in AL or dataset logic.
Business Requirement
The objective was to design a Purchase Order report where the line area maintains a consistent structure, independent of how many lines exist in the actual data.
In other words, the report layout should not necessarily reflect the dataset exactly as it is. The idea was to ensure visual uniformity while keeping the underlying data logic simple.
Proposed Solution
The solution was implemented directly in the RDLC report layout by creating two tables and controlling their visibility through expressions.
There was no need to align them in the same position one table was placed above the other. RDLC automatically handled which one to display at runtime based on the visibility conditions.
Table 1 – Actual Purchase Lines
Displays the real data from the Purchase Line dataset.
Table 2 – Structured or Blank Layout
Displays a predefined structure (for example, blank rows) when fewer lines are available.
This design ensures that whichever table meets the visibility condition is rendered, maintaining layout flow automatically.
Implementation Steps
1. Add Two Tables in the RDLC Layout
- a. Insert Table 1 and bind it to the dataset (e.g.,
DataSet_Result). - b. Insert Table 2 directly below it and design a fixed layout (for example, a table with a specific number of blank rows or placeholders).
- c. The report automatically adjusts the spacing depending on which table is shown.
2. Set Visibility Conditions
To control which table appears at runtime, open each table’s properties and go to:
Table Properties → Visibility → Hidden → Expression
Then apply the following expressions:
For Table 1 (Actual Purchase Lines)
=IIF(CountRows(“DataSet_Result”) <= 8, True, False)
Hides the actual data table when the dataset has fewer rows.
For Table 2 (Structured or Blank Layout)
=IIF(CountRows(“DataSet_Result”) > 8, True, False)
Hides the structured or blank table when enough data rows are available.
Note: The number “8” is just an example threshold. You can set any value that fits your design requirement.
Result
At runtime:
- a. When the dataset contains more rows, only the actual data table is displayed.
- b. When the dataset contains fewer rows, the structured or blank table appears automatically.
The RDLC engine handles layout adjustment, ensuring the report always looks uniform and visually balanced – without any need for AL code changes or temporary data handling.
Advantages of This Approach
| Benefit | Description |
|---|---|
| No AL Code Changes | Achieved entirely within RDLC layout. |
| Upgrade Friendly | Dataset and report objects remain unchanged. |
| Automatic Layout Flow | RDLC adjusts which table is displayed automatically. |
| Professional Appearance | Ensures consistent formatting and structure across all reports. |
Key Takeaways
- RDLC provides powerful layout flexibility through expressions and visibility rules.
- Report presentation doesn’t need to follow the dataset structure exactly.
- Using multiple tables with visibility conditions allows for dynamic, clean, and consistent report designs.
This simple yet effective approach shows that report design in Business Central can be made flexible without altering data logic.
By using two tables with visibility expressions, you can create reports that adapt their appearance automatically – keeping the layout professional, stable, and easy to maintain.
We hope you found this blog useful, and if you would like to discuss anything, you can reach out to us at transform@cloudfronts.com
