SSRS New page per selected Parameter - reporting-services

I have a report which uses 3 datasets and on the report a am using Multiple Tables and Textboxes and expressions. When I run the report I have to select a Parameter which in this example is 'City'.
I want a new page for each City (parameter) , I have read to use page breaks and grouping but I selected a List from the toolbox and put that on top of my report, selected 2 'Cities' and expected it to return 2 pages but it returned 49 pages (majority blank)
I want a separate page per city how can I achieve this?
Thanks

If I understand you correctly (it difficult to be sure if you don't post your current design) then you would be better using subreports.
I'm assuming Cities are in a table in your database and each have a unique ID. If you only have the names then you can use CityName inplace of CityID and it will still work.
Create a new report.
Create new dataset (say dsSelectedCities and the set dataset query to something like ...
SELECT CityID, CityName FROM myCitiesTable WHERE CityID IN (#CityParameter)
This will automatically generate a report parameter called #CityParameter. Set the available values etc just the way you did in your original report, so if you need to add another dataset for this then do so. In this example I've assumed labels will be CityName and Values will be CityID. Whatever goes into the Values is what will be passed to our subreport.
Now add a table to you report, it only needs to be one column wide and one row long so just remove any other rows and columns just make sure you leave the detail row and not the header.
Set the dataset for the table to be dsSelectedCities
Make this remaining cell with wide enough to accommodate your subreport (which will be the report you originally wrote).
In the cell, insert a subreport
Set the subreport properties to point to your original report and set the parameter to the CityID field.
This table will act as a loop, for each record found in dsSelectedCities it will give us one row. As each row will have a single CityID we are passing that to the subreport, the subreport in turn just shows one City.
Set the page break option on the details group to break between instances.
You will probably have to modify your original report to accept a single CityID, it depends on how it was designed but hopefully this should get you going.
If this is unclear then post your current report design including all the details about parameters and I'll update the answer.

Related

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.

In SSRS is there a way to use newspaper columns and still have a new page per group?

My dataset is grouped by customer then itemtype and then the details are the itemcodes and descriptions.
I am using the Newspaper column setting so that the list of items continues on to the right side of the page instead of moving on to the next page.
My problem is that I want to start a brand new page for each customer. Since SSRS treats each column as a page break, I get a page where one column belongs to one customer and the next column belongs to another.
I have tried the page break setting on the different group and the tablix properties to try and force a double page break to happen with no luck. I have also tried to drop a rectangle into the table and use the page break setting there, also no luck.
Any help would be appreciated.
Thanks,
Jessica
I've not used the multi-column layout so I can;t directly comment on that but what you could potentially do is use a subreport.
If the following does not help, post a sample of your data and your current report design and I'll post a full answer.
In short, create a report that only handles a single customer, so it will need to have a parameter passed into it that identifies each customer such as a CustomerID.
Once you have the report working with a single customer, create another report.
On this report create a dataset that just contains a list of customers you want to report on (so a list of CustomerID's for example).
Add a table to the report and remove all but a single "cell". Expand this cell to be roughly the width of your subreport (it does not have to be exact).
Set the dataset property of this table to the dataset containing your list of customers.
In the remaning cell, right-click then Insert >> Subreport. This will fill the cell with a subreport control. Right-click the subreport control and set the subreport to be the sub-report we created earlier that handles 1 customer. In the parameters, set the CustomerID parameter to the field from your customer list dataset.
Finally, right-click the 'details' rowgroup and set page breaks to 'between each instance'.
This will generate one subreport per customer and put a page break between each.

Can you link multiple tablixes on a key field in a single SSRS report?

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.

SSRS Create As Many Tables As Needed (Using One Dataset) Based on a DataSet Field

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!

is it possible to schedule a report to run for every possible option in a parameter list?

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.