I have a report that takes one parameter (an order no) and creates a document for that order, pulling in some address fields, etc.
My customers want the ability to select multiple order numbers at once and print out say 10 different sheets, one for each order. everything would be the same on each sheet, save for the order specific information.
my problem is that currently, toggling the parameter to accept multiple values jams all the information for all 10 orders into the same place on one instance of the report. Is there a way around this?
Please let me know any and all further clarification or examples you need.
Use a sub-report to run the same report multiple times with different parameters.
Create a new report with a multi-value parameter for the order #'s.
Add a tablix that uses the multi-value parameter to display each order #.
Replace the field that displays the order # with a sub-report.
Wire-up the sub-report to point to your original report and pass in the order #.
To make sure each report prints on a different page:
Group by order # in the tablix (shouldn't change the tablix output if each order # is unique)
Right click the Row Group and select "Group Properties"
Choose "Page Breaks" and check the box "Between each instance of a group"
Related
I have a SSRS report that takes a parameter and executes a stored procedure to generate a report with it.
the parameter is a values from a table that I have user select from a dropdown
let's say 15 options that are passed as parameters to each execution.
AAAA
AAAB
AAAC
...etc
is there any way I can setup the report so it will execute with each parameter and generate a report?
the issue is that now the user has to manually select 1st parameter, generate the report and then export the file result to excel.
what I want to do is a way for the user to select multiple parameters and export just one file containing all of them (the stored procedure can't take more parameters because of the way is coded depends on receiving one parameter only)
so it would have to schedule multiple executions of the stored procedure to create the report and then export this. is this possible? (as a note, the amount of parameters will change frequently so I need to give the option of selecting multiples from a list that is populated from a query to database)
and to clarify, the Stored Procedure needs to take only one parameter, this is not to be solved by sending multiple parameters to operate by using a splitter or similar, as the parameter received by the SP is used in calculations depending of order, (to not go into detail with the SP, just need to take one parameter per execution)
As you already have a report that handles a single option then you can do this easily using sub reports. Don't worry about the length of this answer it actually quite simple.
I would make a copy of the existing report to be safe....
Change the existing report to only accept a single parameter value if if doesn't already. Save this report, this will be your sub-report so let's say it's called mySubReport
Next create a new blank report.
Add a dataset (called say dsParameterList) that will give you the list of options you want the user to choose from (I guess this will be the same as your current report?). For example if it was a list of companies it might look something like SELECT CompanyID, CompanyName FROM myCompanyTable
Next add a parameter called say #options, make sure it is set to be multi-value and set the available values to use a query and point this to dsParameterList. Set the value and label fields as required.
Now create another dataset called dsLoop for example. This dataset will contain a list of selected parameter values. Using the company example from earlier the dataset query might look something like this. SELECT CompanyID, CompanyName FROM myCompanyTable WHERE CompanyID IN (#options)
Next add a table to your report and remove columns so that only 1 remains. Set the dataset property of the table/tablix to dsLoop. This means we will generate 1 row for every selected parameter value.
In the detail row right click in remaining textbox and choose 'Insert Subreport'. Now right-click the subreport placeholder and set the properties to point to the report we saved earlier (mySubReport in this example).
Whilst still in the sub report properties, click the parameters tab and add a new entry, choose the parameter in the left column and set the value in the right column to be the value from dsLoop that you want to pass to the subreport. In our company example this would probably be [CompanyID]
That's it. You run the report and choose from the parameter list, when you click View Report the dsLoop query runs and gives us a list of just those selected Companies, the report body is generated with a row for every row in the dsLoop dataset which in turn runs the subreport with a different parameter passed in each time.
Optionally You can right-click the rowgroup under the main design window and set the 'pagename' property to a value. In the Company example this might be =Fields!CompanyName.Value. When the report is exported to Excel each sheet in the workbook will be named with the name of Company
I am creating a report in SSRS to show evaluation scores. It has three sections, and I need to link them all together on the PreceptorID field (2108 in this case). The top two sections are from the same query. I am filtering the results in each one to separate the counts because they have different column names. The third section is a subreport showing comments from evaluators. It also has the PreceptorID field in the data but is not displaying it. It has two parameters that should be populated by the main report query, but that does not appear to be happening. The report is returning all comments instead of only the ones with the matching PreceptorID.
This first image is from Crystal Reports showing how the finished product should look.
This is what I am getting from SSRS. It is showing counts for multiple people at the top. The counts in the middle are actually correct. They are all for the one person. The next person's counts are on the next page. The comments at the bottom are also not filtering on the one PreceptorID.
This image showing the subreport parameter that should be linking it back to the main query.
How can I tell all three sections to only return data for the same person on one page, and another person on the next page?
I would redesign the report structure slightly. This is only my personal preference, there are several ways to achieve this but I find this way easier to manage and maintain.
You'll need two subreports and a master report.
You already have the 2nd subreport so no extra work required there.
I would take you current report, strip out the link to the current subreport and change it so it only processes a single person (just like your existing sub report).
So SubReport1 will have the two tables from your current main report only. It will only accept a single person as a parameter (or pair of parameters in your case)
SubReport2 will be your current subreport. Again it only accepts a single person.
Next create a new report. This will be the master report.
Add a dataset that contains just enough info for list of people you want to report over. So the dataset query might be as simple as
SELECT PreceptorID, ClerkshipID FROM myTable ORDER BY PreceptorID
Add a table to this report and set it's dataset property to the dataset you just created.
Change the default (details) row group to group and order by whatever makes each record unique (maybe both the two columns listed above, may only one will be required, only you will know this).
Right-Click on the row header to the left of your table and do "Insert Row => Inside Group Below".
Remove all but one column
You should now have a table with 2 rows per group.
Right click the top cell in the group and do "Insert => Subreport", go to the subreport properties and point this to SubReport1 (or whatever you called it) and set the parameters has you have done previously.
Repeat this for second row, this time pointing to your second subreport.
In the row group properties, set page breaks to "Between each instance"
That should be it. This was done from memory so might not be 100% but based on the info in your question you should be able to work it out from here.
Things to check if this is not working
Open each subreport and test it by passing in parameters manually. Each subreport should only be returning data for a single person.
The master report should have a dataset that returns each person once i.e. if there are 10 people in total this dataset should only contain 10 rows.
The table in the master report should contain only two rows
Both rows must be EITHER within the same row group, or, if you have no other row groups, they will both be in the detail row group.
The report design should look something like this if you have a row group by person
or like this if you only have detail rows.
Finally, make sure the parameters you pass to your subreports are the Field values from your master report's dataset, NOT your master reports parameters.
I have a query that returns relevant data about inspectors and how long it takes them to respond to issues. The only parameters are a BeginDate and EndDate so for any given date range there could be anywhere from 0 to 100 inspectors.
I am using only one dataset and it contains an "Inspector" field that I'm hoping can be used as a filter to create as many tables as there are inspectors.
I know you can set filters on tables but from my (limited) SSRS knowledge, you must already have the tables created and the filters are typically hard-coded. What I need, is some way for the report to see how many Inspectors there are in the dataset and group those records into their own tables, repeating the same one created tablix over and over as needed.
This is being done strictly in SSRS 2012, not using a ReportViewer where back-end code could help me out unfortunately...
I don't have any code examples to provide, like I said I know you can do filtering but I am at a loss when it comes to doing something like this dynamically based on data... Sorry.
Depending on the report design you could either...
Single report with grouping
1. Create a single tablix.
2. Create a row group by Inspector and then add whatever fields you need to the details section.
3. You can optionally set page breaks between instances of your Inspector rowgroup from the rowgroup properties.
Sub report method
1. Create a subreport that accepts a parameter (InspectorID for example).
2. In the subreport filter the dataset using the parameter passed in so it only return data for a single inspector.
3. Add whatever controls you need to the report to handle a single Inspector
4. Create a main report
5. Add a dataset that gives you a simple distinct list of Inspectors, this will be used to pass parameters to the subreport.
Lets assume it just contains a list of InspectorIDs.
6. Add a list control to the report and set it's dataset property to the dataset that contains your list of InspectorIDs
7. Right-click in the list control's 'cell' and insert a subreport.
8. Set the subreport property to the subreport you created earlier and set that parmameter IsnpectorID to your InpsectorID field.
This will produce a subreport for each instance of inspector it finds.
Sorry about the format of this answer, in a rush!
I have a report that uses a client list as a limiting parameter.
where [account no] = #Client
However I really want it to run once each month for every client on the list. The only way I know of doing this is to set up a different subscription for each client but the list is very long and I'm looking for a quick cheat to prevent me having to set up a few hundred subscriptions.
Is there a way to tell SSRS to run the report once for each client in the parameter list and send the results to an email?
This will create a single report that contains every client, not sure if this will be suitable but here goes anyway...
Create a new report.
Add a dataset that contains a distinct list of client account
numbers.
Add a table with a single column and single row
Make the table the width of your report (minus margins)
Set the table's dataset to be the dataset you just created.
In the table cell, insert a subreport
Set the subreport to be your original report
Set the subreport parameter to be the account number from your dataset (from step 2)
You probably want to add pagebreaks on the detail row group etc but this should get you going.
I have a report that is mostly static text, with a small 1x5 tablix with address info, a list with two expressions and a data set field on it. Currently, it returns the address, forwarding address and order number for a particular order.
I want to be able to select multiple order #s, but for each order #, i want an individually printed report. I selected multiple values for the parameter, and can populate the list with a query that returns all order #s. However, when the user selects multiple orders, it crams all the order addresses into the same spot on ONE instance of the report. i would like a new page for each order #.
Let me know if you need any further info (dataset, query, etc.)
You can place your current report inside a rectangle that you group on order number. Then simply adjust the PageBreak property of the rectangle.