In this series, you will learn the basics of creating a report in the Web Report Designer. This lesson builds on the previous lesson. To follow along, you will need to have the same report we have been creating in the past articles.
Previousy, you learned some styling techniques to apply to controls via their properties.
In this article, we will look at how the web report designer allows you to control and organize information by creating and sorting Groups.
What Are Groups
A group allows you to categorize information and group them together based on identical values.
Taking our example data, we can organize the contacts based on city.
• Sofia Garcia
• Laura Murphy
• Raymond Lee
• Tony Randall
• Amy Ford
We could even use multiple groups to further organize this list by using even more criteria - sales rep, active status, or company name, just to list a few.
Create a Group Header
As in the above example, we will group our contacts by city. First, we need to drag in the city field.
1. Rearrange your PageHeader1 and Detail1 bands to make room for a new field.
2. From the Fields List, drag in the BillAddressCity field from the Contacts table into the Details1 band. Remember to select the Fields List icon first.
3. Click the Properties gear icon to get back to the properties panel. Deselect the field by clicking on the report, or another band. Under Actions, click the icon Insert Group Header Band.
4. Select the band you just created, the GroupHeader1 band. This will show different properties in the properties panel.
5. Expand the section called Group Fields, and then click the plus ( + ) button.
6. You will be asked for a field to Group By. Select the BillAddressCity field. Notice the arrow beside it? That allows you to set the sorting to Ascending, Descending, or none.
7. Save your report, and then Preview it. You will see the contacts are sorted by their city, using the sorting preference you chose.
8. Go back to the designer. Let's make each group stand out more by using the group header. Drag the BillAddressCity field into the GroupHeader1 band.
9. Further style the GroupHeader1 band. In the below image, I minimized the other bands to highlight the GroupHeader1 band.
The following changes were made:
- A panel control was added to group the next three controls. It was resized to fit the entire page.
- The BillAddressCity field had its background color changed to blue, and its foreground color changed to white. The font was also bolded.
- Two line controls were added to be added on the left and right hand side of the city field. Their width was increased to two and set to blue.
- The GroupHeader1 band was resized.
10. Save and then Preview the report after these changes.
Multiple Group Fields
You may have noticed when you added a group field, you had the option to add more fields to group by clicking the plus ( + ) button.
By adding more group fields, you can group your records by one field, and then another. To change the priority of which group field to sort by first, use the up and down arrows.
To remove a group field, select it and then click the minus ( - ) button.
By using more than one GroupHeader bands, you can nest groups. In our example, we will add another group header band to separate the contacts by state.
1. Select GroupHeaderBand1. Under the Design section, name it "GroupCity". Considering we are going to have two group header bands, it would make sense to start naming the bands so as not to get confused.
2. Add a second Group Header Band, and name it "GroupState".
3. From the Field list, drag in the BillAddressState field into GroupState band and style it as you want. I also added another panel control, changed the background color, and resized it to span the page.
4. Save and then Preview this new group header.
Now the contacts are grouped by city, and the city groups are grouped by state.
In the next article, you will learn about detail reports and how to pull related information from another table.