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

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!

Related

Generate 1 report based on multiple executions of stored procedure (passing different parameters to same procedure)

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

Combining multiple drill through reports into one

First time posting here so please be kind.
I've come from using PowerBI to achieve pretty much everything I need to with a couple of clicks to using SSRS 2008... and I'm having a hard time. Here's what I'm trying to do:
I have a main report that summarizes some data on how long it takes to close down help desk tickets. On that report I have a table with summary figures (ie 220 tickets were picked up after 5 working days, 18 tickets were reopened etc). I want to click the text-box that contains 220 and be taken to a drillthrough report that contain the same table with column headers and just different row sets in each case. There will be 8 drill through actions in total and I currently have 8 drill through reports. Only 2 of those are parameter based, the others just filter the dataset based on some conditions.
What I'm trying to work out is this: can my 8 drill-through reports be rolled into one, if they're just different views of the same dataset? I've created some calculated columns with values (Yes/No because boolean doesn't allow multiple values) which are easier to pass to parameters. I also have 8 parameters on my detail data set. I've set up actions (where parameter1 = yes for instance) to take me to my detail report and use the corresponding parameter each time. It should work... but it doesn't and I can't work out why. Currently its' complaining that I can't compare a boolean to an int16 - neither the value in my calculated column nor the default parameter value is boolean or int. So, am I trying to do something that just isn't possible? Has anyone else achieved this?
Edit: here's the parameter
The error I'm getting is
The calculated column that should be checked against the parameter is
=IIF(IsNothing(Fields!DatePickedUpByAgent.Value), "Yes", "No").
Here's how I defined the action to take me to the drill through report in this case
Here are the filters on the subreport dataset based on the parameters passed through from the main report. "NotYetPickedUpByAgent" is the example we've been discussing here. enter image description here
Could you please go through each of your parameters one by one.
I would suggest deleting all the filters and trying to run the report and subreport.
Then keep adding filter one by one.
I think issue can be any of the filter and not the one you think.

Create report base one number of records dynamically in SSRS

Let's say I have the following data:
In my SSRS report I have a parameter that prompts for MainID.
Now If I put MainID as 1, I should get one report. If I put MainID as 6, I should get 3 reports. Is there a way I can generate these reports dynamically using SSRS? Thanks.
I would approach this by creating a report that uses a List control, and has a page break between each item that you use to group by within that List. One report, a different page for each item of interest, SubID in this case.
Create a new report with an empty body.
Add the Data Source(s), Parameter(s), and Dataset(s) that are needed.
Add a List object to the body. Drag and drop it into the body from the Toolbox.
Set the Dataset for the list to the one you are using to return the data you have listed in your question.
In the Row Groups pane of the Visual Studio report designer, right click on the Details row, and choose Group Properties. On the General page, click the Add button under Group expressions, choose SubID from the Group on dropdown.
While in the same dialog, go to the Page Breaks page and check the Between each instance of a group option. Click OK.
Add a Tablix inside the List. This is what will show your data.
Add some fields to the Tablix. Add Detail and Notes, for no good reason on my part.
Run the report. If you have setup the data source and data set to properly run and filter base on your parameters, you should see something. Maybe an empty report.
Now (based on the data you provided), if you choose 1 for your MainID parameter, the report will display one page, but if you choose 6, you will get 3 page3, or however many records there are related to the parameter value for MainID in the database.
One report, multiple pages depending on the parameter/data. It's not a 3 different reports solutions, but something that could work for your situation.

Access - Modular reusable subreport

I would like to create a report which I can use as a sub-report multiple times on the same parent report. However, each occurrence of the subreport should have different values.
For instance, there is a table called DailyReport.
Records in this table contain:
Date, member, team, description
The sub reports should be for each team within a certain date range. However, the date range per subreport/team will not be the same.
So, if the date range for all teams was consistent, then I could create a single subreport, and do some Ordering on the resulting records to separate things out into teams.
However, with inconsistent date ranges, I can't utilize a single query, so the most straight forward solution I see is to create separate subreports and queries for each range of each team.
The problem with this solution is that if I decide to change the format of the subreports I must do so in each specific subreport--a lot of duplicate work.
I would like to create a generic query and subreport. The query and sub report would call VB functions which would return the relevant value.
This means my parent report has the same generic report on it multiple times. As each subreport is rendered, I would like to increment a value behind the scenes so that the functions which the generic query and subreport call know to return a different value.
However, it seems that's not how things work in Access. The subreports on a report are not rendered linearly. A subreport is created, and then "stamped" onto a report where ever required. This means that all of my generic subreports have the same data.
How can I define a generic report and query? Then plug in different values into the report and query while the report is being reused multiple times on the same parent report.
You need to look into the LinkMasterFields and LinkChildFields property of reports. They are designed for exactly this purpose -- to filter a subreport based on current data in the main report, without needing any code or even queries.
You are correct that LMF/LCF do not work on date ranges, only values. So use LMF/LCF for the team filter.
For the date range filtering, you can use an unbound form that launches the report as two parameters defined in the base query. Create frmLaunch, and add two text boxes minDate and maxDate. Set their Format property to Short Date so Access with interpret them correctly and provide the date pickers. Now modify the base query, adding two Date/Time parameters [Forms]![frmLaunch]![minDate] and [Forms]![frmLaunch]![maxDate]. Now, find your date field and set its criterion to Between [Forms]![frmLaunch]![minDate] and [Forms]![frmLaunch]![maxDate]. Add a button to frmLaunch that runs the code DoCmd.OpenReport "YourReportName", acViewPreview.
So, the goal was to make it possible to re-use the same sub-report multiple times on the same parent report, with full flexibility on how the subreport retrieves data.
I placed multiple instances of the same subreport on a parent report. On the subreports Open event I placed a line like
Me.Report.RecordSource = "SELECT * FROM someTable WHERE " & getCriteria()
nextCriteria()
Maybe its possible to pass a value that identifies which instance of the subreport is opening to the getCriteria function. Probably like a getCriteria(Me.Report.Name). But in this case I kept track of how many subreports had been produced in vb.
Unfortunately, if your subreport has controls which have a data source which is a vb function, all reports will show the same value for that control. To get around this I added something like getSomeValue() & "As [Some Value]" into the SELECT of the SQL statement above. Don't forget to add single quotes or hashes around getSomeValue() if you are passing a String or date.
That's basically it, it's a pain. But I couldn't find a more elegant way to do it.
Edit:
One major caveat I experience with doing this, is that although the print preview works correctly, when actually printing or exporting to PDF, some subreports would not be included. Maybe there is something else causing this...

SSRS 2005 report with multiple datasets need to change parameter

All,
I've been working on a custom timesheet report that uses multiple datasets (8 to be exact). Each dataset selects the data by the same ID field which is currently input as a parameter. It works great like that. But now I'm told that the end user wants to input a date and have all the reports printed out for that date rather than having to enter in an ID each time. Each timesheet is 2 - 3 pages. It is intended to emulate a form and contains some data but a lot of blank areas to allow the field people to write in any changes that have occurred.
My question, is this: what is the best way of accommodating the new requirement? Should I build it all as one big dataset and use the date as a parameter?
Should I create a wrapper report that would prompt for the date and then use the existing report as sub report? Would that even work?
Is there any way I can just create a new date parameter and put that ahead of the ID parameter and get them to print out like that? I've got a few hidden parameter fields on the body that get used in the page header and are used to link some of the datasets.
any help is appreciated.
Easiest way to achieve this is indeed by creating a wrapper report with the date parameter. The data set in this report will then fetch all items (with ID) that match the query by the user. The report can then have a list for that dataset, with the original report as a subreport. If you pass the ID parameter from the dataset to the subreport you wouldn't need to change hardly anything in the original report.
Two things to watch out for:
the Report Header and Footer in a subreport are not rendered - these are only rendered for the wrapper report
you may need to tweak your page breaks in the subreport and on the new list in the wrapper report so each new form starts on a fresh page