简体   繁体   中英

How to print out an SSRS report for each customer on the customer dropdown list

We have an SSRS report which takes customerID as a parameter, and we would like to print out a report for each of the customers on the Customer dropdown list. However, there are a few hundreds of customers on the list, and we are not able to go through each one manually. Is there a way to have the report automatically go through the customer dropdown list and generate a report for each customer, so we can print out the report all at once on our end?

You can do this a few ways. As you already have a report that does a single customer then it will be easy to use this as a sub report.

Note that this, as with most options, will give you a single report containing everything, it will not give you actual individual reports..

So, Create a new report. Create a dataset (say dsCustomers ) that contains a list of CustomerID's that you need to report from. This dataset could be a simple query such as SELECT CustomerID FROM myCustomersTable for exmaple.

Now add a table to your report and set it's dataset property to dsCustomers .

Remove the header row from the table as we don't need this and remove all but one column so you tablix is just a single textbox. Make this textbox wide (it's doesn't really matter how wide, it's just to make things easier to see)

Now in the remaining textbox, right-click and choose "Insert => Subreport"

Right-click the subreport placeholder and choose "properties"

Now set the subreport to your original report.

In the parameters section add a parameter entry for your subreport's parameter. Assuming the subreport takes a parameter called CustID then select CustID from the drop down. On hte right side, the parameter value, set this to the name of your dsCustomers dataset field (in this example it would be CustomerID )

That's it...

Now when you run the report, the tablix will produce 1 row per CustomerID,, each 'row' will contain the subreport.

You will probably want to set page breaks on the rowgroup too so each customer starts on a new page.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM