Subreports
Trouble seeing the images? Right click on images and open in new tab to enlarge or zoom in on the page (Ctrl + mousewheel).
A subreport is effectively a method of embedding a report within a report. Finished Reports supports subreport functionality.
Overview
In the following example we're going to create a subreport that totals the transactions by year for each client, and then displays the yearly totals at the bottom of the client section of the report.
Example: Output prior to adding a subreport
Before we review adding a subreport, let's look at what adding simple group totals for each year, for each client, without using a subreport, looks like. As you can see below each monthly total is followed by the yearly total.
Example: Monthly total followed by yearly totals
Our goal is to show a yearly subtotals at the bottom of each client's portion of the report. When completed our report will look like the example below.
Example: Yearly subtotals at the bottom of each client's portion of the report
Step by Step: Setting Up A Subreport
Subreports are linked to the main report using a parameter binding. Before adding a subreport, create the parameter that will be used for binding the main and subreport together. In this example we are going to associate the yearly total with each Client.
Parameter Setup:
Datatype: String
Name: ?SubReportClientParam?
Example: Parameter Setup
Next launch Finished Reports and drop a subreport into the Client's group footer. We are using the Client's group footer section* as our goal is to show yearly totals for each client.
NOTE: Subreports can be added to any section of your report.
Double click on the subreport that was added into the report to build and edit the subreport. In our example we have grouped our report by Client and Assigned Year, with the yearly totals placed on the Assigned Year's group footer.
Example: Grouped report by Client and Assigned Year, with the yearly totals in the Assigned Year's group footer
After the subreport has been created, you can Preview the subreport by clicking Preview. As you can see there are two sets of yearly totals. One for Client1 and the other for Client2.
Next we need to set the Filter String on the subreport. The filter string is going to utilize the ?SubReportClientParam? parameter we created earlier and limits the subreport's data to each individual Client. Click on the subreport's smart tag and click the ... button next to Filter String.
Set the Filter where the Client is equal to the ?SubReportClientParam? View Parameter.
Note: Click the pencil icon to change the argument type in the filter string from a value to a field.
Next, click on the main report's designer tab, then click the subreport's smart tag and Edit Parameter Bindings.
Add a new Parameter Binding. Set the Binding to the Client field and select or manually type (case sensitive) in the Parameter Name that was created at the View Level. The parameter name will be prefixed with "ViewParameter_". When completed click OK.
Click Save. Next, click Preview to view the results:
In the image above we see each Client's yearly totals, listed together, in the Client's Group Footer.
Comments
0 comments
Please sign in to leave a comment.