SSRS 2008: Passing Parameters to linked report - sql-server

I have a report table with all the combinations of dimensions as generated by the parameters set by the user. Each row contains 1 combination and a link to another report with charts. How do I pass that combination of parameters/dimensions to that other report?
In the row, I have a textbox Action which has a "Go to report" hyperlink. In the main report. I see an option "Use these parameters to run the report" which I fill out with the similarly named parameters on both reports.
On the linked report, the user should not have to pick options from that set of parameters again. Setting the report parameters to internal, hidden with blank prompt (a single space), visible with blank prompt (a single space), and putting a (Null) default value still gives: "The report parameter is read-only and cannot be modified. (rsReadOnlyReportParameter)"
What gives? How should the parameters be configured on either side so the combination of parameters are passed to the linked report?

If it is truly a linked report, then you should be able to hide the parameter in the linked report properties.
If it's a drill through report (more likely), then just set the parameter to hidden in designer. Internal means it is not exposed at all:
Setting the Hidden and Internal
options provides different levels of
visibility. You can hide the parameter
on the parameter input area of the
published report, yet set values for
it on a report URL [My text: this is what drill through does] or in a
subscription definition. If you set a
parameter to Internal, it is not
exposed in any way except in the
report definition.

The real solution to the real problem probably lies somewhere else, but just recreating the report item from scratch instead of using the converted (from SSRS 2005 to SSRS 2008) report item solved the problem described above. The drillthrough report should have the parameter hidden.

Related

How can I select all parameters to run a report, but have them run independently

My quality engineers have asked me to create a report based on a document that they fill out manually. At first glance, it appeared to be an easy enough request. It has been anything but easy. This report shows the results of two inspections and I have a parameter where the user selects one inspection or the other. As it stands now, this report runs just fine when selecting one inspection, but I am anticipating a request to be able to run the reports for both inspections at the same time. And, that's where I run into trouble.
The problem is that I have a text box in the header that is referencing a value from a table in the report that identifies the inspection. When I set the parameter to a multi-value parameter and select all, the report only displays one of the inspections across the entire report. Is it possible to have the user select both inspections but have the report run them separately? I have one dataset for the table and a column in that table that identifies the inspection. I have tried the multi-value parameter and I have tried using the filter option in the dataset properties, but I get the same result.
The easiest way to do this might be to create a new master report and use your current report as a sub-report. It's fairly simple.
Here's the basic steps...
Make a copy of your current report and rename it (say sub_InspectionReport)
Change this report so the the inspection parameter is NOT multi-valued
Create a new report and add your parameter(s) the same as you setup for your original report, This time make sure your Inspection parameter (e.g. pInspection) IS multi-valued.
Create a dataset (dsInspectionIDs) that returns a list of the selected inspection values from the pInspection parameter. The query could be something simple like
SELECT InspectionID FROM myInspectionTable WHERE InpectionID IN (#pInspection)
Note: #pInspection is the name of your report parameter, it is case sensitive.
Now add a table to the report and, as a simple, test, se the dataset of the table to your daatset dsInspectionIDs. Set the first column to show the only available field (in this example InspectionID).
Run the report and test the output using different inspection parameter selections. The table should match what you have selected...
We're almost there...
Now in one of the table cells (but not in the header) , right-click and select "Insert / Subreport". Now right-click the sub-report placeholder and set the sub report to be the copy of the original report we made at the start (sub_InspectionReport in this example). Now, still in the sub-report properties, go to the parameters tab and set the Inspection parameter to the the InspectionID field.
Now when you run the report, you will get your sub-report run once for each selected parameter value with that parameter passed to the sub-report.
Hope that makes sense, I'm not near my PC so I can't provide a sample with images at the moment.

SSRS Report Builder Sub-Report Sorting

I have an SSRS report that contains 20 sub reports in it. Each sub-report represents a phase in a specific cycle. All sub-reports are identical in formatting and such, containing specific data to that phase and displaying a start and end date. I was wondering if there is a way in Report Builder to essentially have those sub-reports be dynamic and sort themselves based on their specific start dates instead of just displaying them the one I have them listed in my report?
This is quite simple.
You already have you main report and sub reports so that's good. I assume your subreport takes a parameter which indicates the phase.
Assuming this, let's say the parameter your sub-report accepts is called pPhase
In your main report, remove all the existing sub reports
Next, create a dataset, lets call it dsLoop
Set dsLoops dataset query to return the phases in order for example SELECT DISTINCT PhaseNumber from myTable ORDER BY PhaseNumber
Now add a table control, remove the header row and two of the columns leaving just a single cell.
Make this cell as wide as you need, wide enough for your subreport, height does not matter.
Set the DataSetName property of the table to dsLoop
In the remaining cell, right-click and choose Insert --> Subreport. A subreport control will fill the cell.
Right-Click the subreport control and choose Subreport Properties, choose your subreport from the list
Still in the subreport properties, click the parameters tab, add a new parameter.
Set the Name to the parameter name that your subreport accepts (pPhase in our
example) . Finally, set the Value to the name of the field that contains
your parameter data (PhaseNumber in our example)
That's it...
Now when you main report runs, a row will be created in your table for each entry in dsLoop, each row will contain your subreport and each will have the parameter passed to it that is specific to each row.
If you have any issues, let me know and I'll post a full example.

SSRS - Report Based on Parameter Selection

We have a web based report we are moving to SSRS. In the SSRS report, I need one report to be able to call three different stored procedures based on the selection of a parameter value, and the output / report display would also be different.
I believe I can create three different datasets for each procedure but I don't want all three to actually run when the user selects "View Report", as that would be excessive execution.
How could I get only one procedure to be called and only the correct report section to show based on the parameter?
Let me try and give an example if the above doesn't make sense:
Parameter: Report Type
Values: Day / Month / Year
If the user selects "Day" for the report type parameter, I need to call "SP_ReportDay". If the user selects "Month", I need to call "SP_ReportMonth" and if the user selects "Year" I need to call "SP_ReportYear".
Each report type would have different data displayed. It isn't the same columns for ecah report and the data displayed is different.
How would I show / hide sections based on the selection criteria along with calling the correct procedure?
If the result sets are different, you don't have many choices besides running all three sprocs. BUT you can add a parameter to each sproc that tells them, respectively, not to actually return any results. Your report can set this parameter at run-time. You'll have to modify the body of your sprocs accordingly.

Passing a parameter from main report to drillthrough SQL Server Report Builder 3.0

I am trying to restrict what users can view based on the branch that they work in. I have it working on my main report but I want to pass the branch parameter from my main report to a drillthrough subreport. How can I do this in Report Builder 3.0? Thank you.
You can pass the parameter via the url.
Example:
http://myrshost/ReportServer?/AdventureWorks 2008R2/Employee_Sales_Summary_2008R2&ReportMonth=3&ReportYear=2008
Here we're passing the report parameter ReportMonth the value 3 and ReportYear with 2008
An alternative to using a URL, you'd need the same parameters in both reports.
Go to the properties of where you want the drill-through to occur.
Go to Action
Select 'Go to Report', specify the report directory (this can be flat files or via the report server). Think this can also be a URL but I am not certain.
Select 'Add'. In the Name field, you want to put the parameter name of the parameter in the drill-through report, in the 'Value' field you want to enter the parameter of the report that you're currently in.
If you don't want the user changing this parameter, in the drill-through report, you can simply hide this parameter in the drill-through report.
This is by far the easiest way of doing what you require I believe. Hope this helps if you're still struggling.

Run reports on all available parameter value

I set several parameters for a report created in SSDT (SQL Server Data Tools).
How can I run the report on all available parameter value and form a comprehensive
report with each case per session?
Thanks a lot.
E.g. a report called 'data growth' with parameters #database and #tablename. A serial of available names for these two parameters. I would like to compile the report with all cases.
You have two options.
1.
Manually include an additional All option into your parameter selections, either by adding a value in the menus or unioning the value if your parameter options are data driven, and set the source query to return all results when selected.
2.
Change your parameter to a multi-value parameter and change your source query to use where database in(#database) which will enable all combinations of your parameter to be selected, including all.

Resources