newbie question: databands

edited 1:24AM in FastReport .NET
Hi all,

I am quite new to FastReport and want to understand it thouroughly before I learn it false.

As indicated in the description, could someone please explain the following to me (the more into detail you go, the better):

What difference difference does it make to put the report data into a child band, a detail band or all in the master band?
If I put everything into the master band, I can steer the required information quite nicely with a very detailed SQL-statement (joining and grouping, etc.)?
Why should I consider using the other possibilities?

Thank you very much for taking the time to answer this.

Bye,
Rob

Comments

  • Hello!

    Thank you for your question and for your systematic approach to learning FastReport .NET. The choice between a single DataBand, a Master–Detail relationship (DataBand + nested DataBand), and a ChildBand directly affects the accuracy and simplicity of the report.

    1. Everything in a single Master DataBand (via a single large SQL JOIN)

    Suitable for flat tables (a 1:1 relationship or a simple list of order lines with the customer’s name).

    Drawbacks for complex reports:

    Data duplication: With a 1:N relationship (e.g., “Order → Order Items”), the order header data is repeated in every row of the query, resulting in unnecessary data transfer, and you have to artificially hide duplicates in the report using a GroupHeaderBand or the Duplicates property.

    Inability to display multiple independent details: if a single master record has two independent lists (for example, “Order → Line Items” and “Order → Payments”), a single SQL JOIN will produce a Cartesian product (N × M rows) and distort the totals.


    2. Master DataBand + Detail DataBand (Master–Detail hierarchy)

    In FastReport .NET, a nested DataBand is bound to a child table and linked to the parent band via a Relation object (in the “Data” window / Dictionary.Relations) or via a Filter. When to use: for any 1:N and 1:N:K relationships (Order → Line Items, Customer → Orders → Products).

    Advantages:

    The main row is printed exactly once, and only the child rows related to it are listed below it.

    You can connect several parallel Detail bands to a single Master band (separate “Line Items” and “Payments” bands) without duplicating data.

    Each Detail band can have its own DataHeaderBand, DataFooterBand, and Totals, and the PrintIfDetailEmpty property allows you to control whether to print the parent record if it has no child rows.


    3. ChildBand (child band)

    Important: The ChildBand is not intended to iterate over rows from another database table it does not have its own DataSource. It is tightly bound to its parent band and is printed once immediately after it (for each row of the parent).

    When to use:

    To conditionally display an additional area within a single record (for example, a comment or warning line hidden via VisibleExpression or the BeforePrint event, so that no empty space remains when the ChildBand is hidden).

    To split a tall parent band into logical parts (so that only the ChildBand is transferred to the page, rather than the entire block, or conversely, to keep them together using KeepWithData / KeepTogether).

    For special modes such as CompleteToNRows or FillUnusedSpace (filling empty table rows to the end of the page).

This discussion has been closed.