Subreports

Tony Coffman -

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.  Here's our example output prior to adding a subreport:

mceclip0.png

Before we review adding a subreport let's review 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.

mceclip1.png

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 this:

mceclip2.png

 

Step by Step

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 and created a string parameter called ?SubReportClientParam?

mceclip4.png

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. 

*Subreports can be added to any section of your report.

mceclip3.png

Double click on the subreport 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.

mceclip9.png

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.

mceclip11.png

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.

mceclip8.png

Set the Filter where the Client is equal to the ?SubReportClientParam? View Parameter.

mceclip10.png

Next, click on the main report's designer tab, click the subreport's smart tag and Edit Parameter Bindings.

mceclip12.png

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.

mceclip13.png

Click Save.  Next, click Preview to view the results:

mceclip2.png

In the image above we see each Client's yearly totals, listed together, in the Client's Group Footer.

Have more questions? Submit a request

Comments