In this lesson, you modify your report to add grouping
and sorting to organize the column information. You sort and group
the column information by table, and within each table group you sort
and group the column name by data type. For each data type, the column
names are sorted alphabetically.
To group data in a report:
- If the report design is closed, double-click the MyTest.rptdesign file
in the Navigator view. The
report opens in the Report Editor view.
- Open the Layout tab at the bottom
of the Report Editor view to view the report layout.
- Select the table:
- Hover over the table. The table handle
appears:
.
- Click the table handle. The guide
cells appear. The guide cells for the rows display at the left of
the table. The guide cells for the columns display at the top of the
table.
- Group the table detail rows by the column data type:
- Right-click the detail row guide cell (
) and click Insert Group. The guide cell is to the left of the detail row, as shown in
the following image: The New Group window opens.
- Complete the New Group window as
described in the following table:
Field |
Setting |
Name |
Type GroupByType. |
Group On |
Select Data Type from
the list of options. |
The New Group window
should look like the following image:
- Click OK.
- Create a nested group element that groups the detail row
by the source table name:
- Hover over the table. The table handle
appears.
- Click the table handle. The guide cells
appear.
- Right-click the guide cell for the detail row and select Insert
Group. The New Group window
opens.
- Complete the New Group window as
described in the following table:
Field |
Setting |
Name |
Type GroupByTable. |
Group On |
Select Source Table. |
- Click OK to insert the group
into the table.
The table contains two groups. The group named GroupByType is
the outer group. The outer group has a guide cell label 1.
The group named GroupByTable is the inner group.
The inner group has a guide cell label 2
- Change the order of the grouping that occurs in the table:
- Open the Outline view.
- Expand the node and select the Table Group - GroupByTable element.
- Drag the Table Group - GroupByTable element
so that the element is above Table Group - GroupByType.
When you drag the group element, a guide line appears that
shows you where you can drop the element in the outline hierarchy.
The group elements are rearranged in the Outline view,
as shown in the following image:In the Report Editor Layout page,
the order of the groups also changes.
The GroupByTable group
is the outer group, and the GroupByType group
is the inner group. When the report is generated, the information
in the table is grouped by source table name. Within each table name
grouping, the information is grouped by data type.
- Format the elements of the report by using the steps in
the following table:
Element to format |
Steps to take |
[Name] data element |
- In the Report Editor, select the [Name] data
element. The properties of the [Name] element
display in the Property Editor view.
- In the Properties tab of the Property
Editor view, open the Padding tab.
- In the Left field, type 40.
|
[Data Type] data element |
- In the Report Editor, select the [Data Type] data
element.
- In the Properties tab of the Property
Editor view, open the Padding tab.
- In the Left field, type 20.
|
[Source Table] data element |
- In the Report Editor, select the [Source Table] data
element.
- Select the General tab in the Property
Editor view, then change the color to Blue.
|
The report design should look like the
following image:
- Create a header row and labels:
- Create a new header row.
Select the guide
cell for the table header row that contains the Data Type data
element and right-click and select .
.
- In the Report Editor, move the Name and Data
Type labels from first header row to the new header row
that you created.
Drag the Name label
to the left column and the Data Type label
to the right column.
- Format the Name and Data
Type labels.
Select the Name label
in the Report Editor to view its properties. In the General tab
of the Properties view, change the text format
to Bold. In the Padding tab,
change the value of Left padding to 40. For
the Data Type label, change the text format
to Bold, but do not change the padding.
- Delete the empty first header row. Select
the guide cell for first header row. Right-click the guide cell, then
click Delete.
In the Layout page of the Report
Editor, the report design looks like the following image:
- Select the Preview tab in the Report
Editor to preview your report and test the column sorting and grouping. The preview of the report is displayed. The report lists
the column information grouped by table with the table names in blue
text. For each database table, the column names are grouped by data
type.
The preview should look like the following image:
You grouped the column names in the report by name and data
type. The elements in the report are sorted by the type of data, providing
a clearer view of the columns that are in the GOSALES schema.
When you run the report design, the report lists column information
sorted and grouped correctly. You can further refine your report to
nest a second table within this table. The information that is contained
in the new table will depend upon the outer table. You will do this
task in the next lesson.