Work with nested sections
Sections in ReportBro provide the ability to iterate a list of data with more layout options than a table. To get familiar with sections we recommend to read our tutorial for printing data with sections before heading towards the more sophisticated nested sections.
Nested sections allow to iterate lists of data within other lists, hence supporting the creation of data groups. Note that this feature is only available in the PLUS version.In this tutorial you will learn to:
1 Create a nested parameter list
Sections require a parameter of type list as a data source. Nested sections require nested list parameters, i.e. a parameter of type List itself contains a list as a parameter.
Let's take the example of a sports league. The league consists of multiple teams and each team consists of various players. Each team has a name. Every player is known by name and shirt number and also has a picture. We want to print all teams with their players.
Let's create the parameter list teams.
We specify the fields of the team with the following parameters:
- team_name (text)
- players (list)
As you can see the parameter players in the team list
is itself a list. Let us now create the parameters of the player list:
- name (text)
- number (number)
- picture (image)
Finally, we add corresponding test data for the parameter lists which is used to preview the report.
2 Apply nested sections to the layout template
The list parameter teams can now be set as data source for the (outer) section. This allows us to access its parameters. The teams section will therefor iterate over all available teams.
Within the teams section's content band, we create another section called players and apply the list parameter players as its data source. This section will subsequently iterate over all available players within the respective team.
We continue with the layout design by adding the player data to the inner player section content. We use a frame to set a background for the data rows but a frame isn't mandatory.
Print it like a Bro
Let's have a look at the result. Looks like the season can be opened.
Following this guide ReportBro puts as many section contents onto one page as possible. If you'd like to print one team per page have a look at the basic section tutorial which explains how to print one data set per page.
Try it yourself:
Download the report
of this tutorial
Read here how to import the report into ReportBro Designer.
By the way, ReportBro is also available for everyone as open-source on github (see Download page). Star us on github if you like what you see!