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.
Related
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.
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.
I just started working with SSRS, and figured out how to connect my MDX Query to a Cube and plug that into a Matrix
However, i need to have a matrix, and in each section, i need to call a different DataSet.
For example:
Matrix1 would have a repeating section based off DataSetA (let's say its customer centers).
in each section (customer center) of Matrix1 i would have a Expression, which calls DatasetB, using a value from DataSetA as parameter (let's say it would be a separate MDX query getting some other information based on customer center ID).
so my expression from within a tablix cell is something like this:
=First(Fields!MTD_Trades.Value, "DatasetB")
is it possible to pass a MDX query filter (or where clause) using a parameter from this point?
ideally it would be something like this (pseudo code):
=First(Fields!MTD_Trades.Value, "DatasetB") WHERE Fields!Where_Filter.Value
something along these lines.. where the MDX WHERE section is dynamic based off another query
UPDATE - solution explanation
here is an example of what i am doing: Let's say the application is based on air traffic and the business user here is some aviation authority person. I will give that person a UI that will let them define the slices they want to see. For example they can come in, and create n slices (i.e. International Flights, Flights leaving US, Flights Arriving After Midnight, Flights with 50+ passengers... n). As you can see, they will have the freedom of adding any filters they wish to each slice.
Then based on their actions (using GUI), i will generate the necessary MDX queries (one for each slice).
My challenge here is to create a SSRS report that will show a separate line for each one of those slices (1-n). Hope that helps in understanding my conundrum. The first part of the query will be the same for each slice (# of flights), but the WHERE section will be different and dynamic for the report.
You can use the lookup() function to access data in another dataset from within a reportitem but you cannot run multiple sub-queries within the report. You can only do this within the parameters where one parameter can be an input for another query driven parameter.
The best course of action is to modify your original query to contain all the data you need for the Matrix.
EDIT: It sounds like you need to use a multivalue parameter.
In the "Slices" parameter set it to allow multiple values
In the dataset which accept this parameter, goto the parameters form and set the value to an expression which is =Join(Parameters!Slices.Value,",").
Pull apart the string in you query and run each subquery then return as a set.
We have a report in SSRS 2005, where in we wanted to update one parameter(which is not linked to any other report parameters or dataset) based on the value of another report parameter(which is the selected value from a dataset). Can anyone let me know how to achieve this functionality?
This sounds wrong. If you have parameter A that is selected from a drop down, and parameter B that is typed in, you want to change B to f(A,B)? Instead, write your query to calculate f(A,B) and use that value.
Instead of trying to create a report parameter field that is filtered based on another parameter, create a report that produces the list of desired values. Make the values in the report be links to another report where the selected value is passed in as a new report parameter.
Or, depending on your situation, it may be better to do the same sort of thing as a web page. Create a page to let the user filter and select the desired values for the parameters, then pass them in to the report.
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.