RDL Editor - Data & Expressions
Binding fields
Every textbox and table cell has a Bind to field / insert snippet dropdown under its Value:
- Pick a dataset field → the value becomes
=Fields!X.Value. The list comes straight from the report's<DataSets>— you never type a field name blind. - Pick a snippet → a ready-made pattern is inserted with this report's dataset/field names already substituted.
Expression inputs (sort, filter, group expressions, Hidden) autocomplete from the same pool: type = and the suggestions appear.
What the autocomplete knows
| Prefix | Source |
|---|---|
=Fields!X.Value |
The report's dataset fields |
=Parameters!X.Value |
The report's parameters |
=ReportItems!X.Value |
Every textbox name in this layout — the editor knows them all, so the header/footer helper pattern (below) is two keystrokes instead of memory work |
=Globals!…, =User!… |
PageNumber, TotalPages, ExecutionTime, ReportName, RenderFormat.Name, Language |
The snippet library
| Snippet | Pattern |
|---|---|
| Page N of M | ="Page " & Globals!PageNumber & " of " & Globals!TotalPages |
| Print date/time | =Format(Now(), "yyyy-MM-dd HH:mm") |
| Document-level value | =First(Fields!X.Value, "DataSet_Result") — for values constant per document shown in a grouped area |
| Sum | =Sum(Fields!X.Value) — the result depends on where the textbox sits (group footer = group total) |
| Conditional text / color | =IIF(Fields!X.Value < 0, "Red", "Black") |
| Hide when blank | =IsNothing(Fields!X.Value) Or Fields!X.Value = "" — for row visibility on optional lines (Address 2 etc.); hiding only the textbox leaves an empty row |
| Alternating row color | =IIF(RowNumber(Nothing) Mod 2 = 0, "WhiteSmoke", "White") — scope RowNumber("GroupName") to reset per group |
| Hidden body value | =ReportItems!TextboxName.Value — see below |
The page header/footer pattern
Page headers and footers cannot read dataset fields directly. The BC convention:
- Put the value in a textbox in the body (often inside the line table so it's on every page).
- Hide it; give it a clear name (
HiddenDocumentNo, notTextbox183). - In the header/footer textbox:
=ReportItems!HiddenDocumentNo.Value.
The editor enforces the rules around this pattern with inline warnings (chapter 7): Fields! in a page band, more than one ReportItems! per header expression, references to textboxes that don't exist, and the Word-export page-number trap (Globals!PageNumber.ToString freezes — use plain Globals!PageNumber).
One more constraint from the renderer: the referenced textbox must actually be on the rendered page — a body textbox that only appears on page 1 makes the header value blank (or #Error) on page 2+. Put the hidden helper in a repeating row when it's needed on every page.
Format strings
The Format field (Font section) sets the .NET format string for numbers and dates:
N2 #,##0.00 #,##0.00;(#,##0.00)
yyyy-MM-dd dd/MM/yyyy
Format the display, not the data: a value that must sum or sort correctly should stay numeric in the dataset and get its formatting here.
Visibility
Items, cells, table rows/columns, and group members all have a Visibility section: a Hidden value (true, false, or expression) and a Toggle item (the textbox that gets the +/− drilldown control).
The semantics feel backwards at first and the editor labels them accordingly: the expression returns true to HIDE. Statically hidden things render dimmed on the canvas, like Report Builder.
Interactive sort
The Interactive sort (expr) field on a textbox/cell (typically a column header) adds the click-to-sort arrows in interactive preview: set it to the field the column shows, e.g. =Fields!Amount.Value.
Keep business logic in AL
Layout expressions are for presentation: hiding blank rows, coloring negatives, formatting, concatenating display text, page numbers. Tax math, discounts, currency conversion, compliance decisions belong in the AL report — calculated once, delivered as dataset fields. Two technical reasons beyond hygiene: IIF() evaluates both branches (a guarded division can still fail), and layout filters don't reduce the data BC processes.