Practical tutorial covering the Business Central AL dataset, RDLC groups, page breaks and PDF rendering. Unexpected blank pages and duplicated totals are usually caused by interactions between dataset structure, grouping, body width and rendering rules. This guide approaches the problem systematically.
1. Define the page model before designing the report
Write down the intended sections: cover page, balance sheet, income statement and supporting schedules, for example. For each section, decide whether it starts on a new page, whether tables may span pages and which headings must repeat. Distinguish fixed-format sections from sections whose length depends on data. Hard-coded page numbers become unreliable when the amount of data varies.
2. Keep the AL dataset separate from presentation
AL supplies a named dataset and RDLC arranges the output. Prefer meaningful dataset column names and validated source calculations instead of hiding business logic in report expressions.
report 50100 "Account Summary Example"
{
UsageCategory = ReportsAndAnalysis;
ApplicationArea = All;
DefaultRenderingLayout = SummaryLayout;
dataset
{
dataitem(GLAccount; "G/L Account")
{
column(AccountNo; "No.") { }
column(AccountName; Name) { }
column(AccountBalance; Balance) { }
}
}
rendering
{
layout(SummaryLayout)
{
Type = RDLC;
LayoutFile = 'Layouts/AccountSummary.rdl';
}
}
}
This is an educational dataset, not a complete statutory financial statement. A production balance sheet needs account mappings, date filters, comparison periods and reconciled aggregation rules.
3. Tablix groups, KeepTogether and PageBreak
Use Tablix parent groups to represent business sections. Attach page breaks to the group or containing region where the break is actually required. Multiple nested page-break settings can create unexpected blank pages. KeepTogether is a best-effort pagination hint: a group that cannot fit on one page must still split, and keeping smaller groups together may produce whitespace.
4. Diagnose empty pages
First check the page width: body width + left margin + right margin must not exceed the page width. For A4, the page is 21 cm wide; with 1 cm margins on each side, the usable width is 19 cm. An element extending slightly past the right boundary may trigger an additional horizontal page. Also inspect hidden objects, container dimensions and whitespace handling. If only the first page renders, inspect dataset filters, visibility expressions, group structure and renderer behavior rather than assuming every problem is caused by PageBreak.
5. Headers, footers and page numbering
Company details, document title, print date and page numbers may belong in report headers or in explicit body regions depending on the format. RDLC exposes Globals!PageNumber and Globals!TotalPages. Decide whether the document needs global numbering or section-specific numbering and test the rendered result. Do not hard-code page numbers for dynamically expanding groups.
6. Calculate totals in the correct scope
=Sum(Fields!AccountBalance.Value) aggregates within an RDLC scope. A wrong scope can count the same amount repeatedly or omit records. Specify which totals are prepared in AL and which should be calculated in the report layout. Test zero balances, negative amounts, previous-year figures and empty sections. Visually attractive output does not demonstrate accounting correctness.
7. Step-by-step troubleshooting
- Render the report with a small dataset and without manual page breaks.
- Inspect actual dataset values in a simple debug table and reconcile them to Business Central.
- Verify paper dimensions, margins and all object widths.
- Add groups incrementally, then enable only the required page breaks.
- Test repeated headings and KeepTogether behavior.
- Export to PDF using empty, short and exceptionally long sections.
8. Regression testing and maintenance
Maintain cases for zero records, one record, multi-page tables, long account descriptions, negative values, large amounts and each supported language. Where a pixel-accurate format is required, compare rendered PDF pages against the approved reference. Font availability and rendering differences matter. Keep AL and RDL files under version control and document layout-specific assumptions.
Conclusion: Reliable report pagination depends on both a verified dataset and an intentional layout model. A page break is only one part of that design.
Discussion (0)
No comments yet. Be the first to contribute.