Nested tables are used for several reasons.

  1. As the result of a grouping operation.
  2. As the result of a 1-to-many join in a relational database.
  3. From a 1-to-many relationship in the object oriented model.
  4. If the element class contains another collection.

Tables can be nested to any depth. They are created automatically by the table wizard when you group a collection. For nested collections and 1-to-many relationships nested tables are created manually.

An alternative to a nested table is a master-detail report. There each object in the outer collection starts at a new page as the master object and the inner collection becomes the main table.

Creating Nested Tables

There are two ways of creating a nested table:

In the screenshot above the outer table has been added.

  1. This is the outer collection as it appears in the field tab.
  2. This is the inner collection that gets added as a nested table.
  3. This is the outer table as it appears in the editor pane.
  4. Here is where we drop the openOrders collection that we drag from the fields tab.

After dropping the inner collection - the table wizard appears. Select the fields you want to add and set the various other options. The result can be seen in the screenshot below.

  1. Here is the inner table. It has been placed on the same line as the outer table. Therefore the first line of an inner table starts in the same line as the outer table. To add an inner table below the outer table drag the collection for the inner table to the bottom edge of the outer table.

Note: The headers of the nested table share their space with the header of the outer table. As a result they will not be repeated for each inner table. (To repeat header for inner tables see below.)

The resulting output is:

Controlling the Nested Table's Position and Headers

The position of a nested table is determined in the same way as for other cells added via drag and drop. If you do not want the inner table to have headers turn off headers on the style page of the table wizard. This is shown in the screenshot below.

Cascaded Styles for Tables

Note: The table, text and border styles of the nested table cascade from the outer table to the nested table. Any style that is not specified (set to inherit) in the nested table will be the same as in the outer table. A style specified in the nested table overrides that of the outer table.

Related tasks: