In this series, you will learn the basics of creating a report in the Web Report Designer. This lesson builds on previous articles. To follow along, you will need to have the knowledge learned from previous lessons.
Previousy, you learned about calculated fields.
In this article, you will learn how to tally totals using Summaries. For example:
- running count of contacts in a list
- a sum of invoice totals
- a percentage of gross earnings
- any other information valuable to your business.
The summary function can generate these numbers in a variety of different ways. This section of the documentation will run down two examples of how summaries can be used:
- a basic example to illustrate the fundamentals of using summaries to influence a whole report
- an advanced example showing how summaries can be used within individual elements of a larger report.
How to Apply a Summary (Basic)
In order to illustrate how a summary is used, let’s tally the total number of customers in the report we made in the last lesson.
1. Drag a label control into the PageHeader1 band.
2. Make sure the properties panel is showing. The Data Binding drop down menu will display all the tables associated with the base table selected when the report was created. When you select it, you will need to expand the line with your method account, and then expand the Customer table.
3. Search through the above list until you can find and select the RecordID field within the Customer table. Since we're doing a count of records, it doesn't really matter which field we choose.
4. Below the Data Binding section, you will find the Summary section. Expand it, and set the following:
This determines the span of data to be included in the calculation. In our example, this prompts the summary to count every single customer record shown in the report. If there were multiple pages, I could change this to "Page", and it will only show the number of customers on that page.
There are a number of functions to choose from. This will simply count the number of records, and thus it didn't matter which field we chose in step 3.
5. If you were to preview this at the moment, there would be a random number in the report header with no context. Let's add words to explain what it means. Above the Summary, you will find the Text Format String which you should be familiar with, but we are going to create a custom on. Click the ellipsis (...) to bring up Format String Editor window.
6. Select General. The preview will show what the result looks like.
- Prefix: type in "This report has ". Make sure there is a space at the end.
- Suffix: type in " customers." Ensure the space at the beginning.
7. Click OK. Save and Preview the report.
And that’s it! You’ve used a basic summary to generate information about your report. Now, let’s take a look at a more complicated example.
How to Apply a Summary (Advanced)
In this example, we will apply a summary to a group, as opposed to the whole report as shown previously. Let’s assume you’d like to find out the total commission for each customer. Again, we are using the report you created in the last lesson.
1. Drag a Label control into the GroupFooter1 band which is inside of the DetailReport1 band. Place it underneath the commission calculated field, beside the Customer.Balance field.
2. With the new label still selected, expand its Data Binding and select the calculated field 10% Commission.
3. Style the label so that it displays as currency and is right aligned. Also add a top border to separate it from the column, just like the other total.
4. Under its Summary, you have two more things to change:
This tells the summary function that we only wish to apply the function (the sum function) to the values within the group.
This tells the summary how we want to summarize. In this case, we are adding up all the values.
5. Save and Preview the report.
And that's it! We now have a total for the commission using summary.
Next up, we will take a look at conditional formatting.