I have a subreport which use a parameter from main report to filter the data. The subreport's dataset is the same but SSRS keep making call to SQL to get it for every parent in main report.
I already set the cache for all dataset and set the parameter as not used by query.
Is there anyway to set the subreport's dataset run only one and then filter the data in subreport using the parameter?
Here is an example of my query
Main Report: Select ClassID, ClassName from Class (Dataset 1)
Sub Report: Select ClassID, StudentName from Student (Dataset 2)
Main report will pass ClassID as parameter to Sub report. Sub report will use it as a filter for Dataset 2 and return StudentName with same ClassID in subreport
My issue is if Dataset 1 return 8 rows, then the Subreport will run Dataset 2 8 times.
Have you tried using a separated dataset? I had a similar problem once and it turned out being some kind of loop.
If you use a dataset filter instead of a report parameter, it will be able to take advantage of the report cache.
Related
I have two reports were I pass multi-valued parameters to it's underlining data and both reports work very well independently. The parameter strings are being split using the function dbo.UTILfn_Split. When trying to drill from the main or Summary report into the sub or Detailed report all other parameters field in the report are populated except the multivalued parameter field. The parameter lists or value are listed in the detailed report but not selected and therefore cannot run the report even though the detailed report parameter property is set to allow multiple values. In both reports, the where clause is set "IN" not "=." How do I fix this?
In your Summary Report, when you pass the parameter to the sub or detailled report, the passed value parameter should be like this expression:
=join(parameters!yourMultivaluedParameter.Value,",")
after that, you pass the name of the parameter to the corresponding parameter in the dataset Detailled report.
In your SQL (SP), get the multivalues of the parameter by spliting it with your function
like following, depending of the result of your function, for exemple:
INNER JOIN dbo.SplitFunction( #yourMultivaluedParameter,',') tmp on tmp.yourColumn = ...etc...
Hope it helps...
i create a multidimensional report with a couple of multi value parameters. In the next step, i convert the datasets in shared datasets. Actually my problem is that i cant add parameters to the shared dataset in the report.
Can anybody explain, how i add multi or single Parameters to a shared dataset in a report?
Parameter1 - Dataset:
WITH MEMBER [Measures].[Unique] AS [Dimension1].[Dimension1].CurrentMember.UniqueName MEMBER [Measures].[Caption] AS [Dimension1].[Dimension1].CurrentMember.Member_Caption MEMBER [Measures].[Level] AS [Dimension1].[Dimension1].CurrentMember.Level.ordinal SELECT { [Measures].[Unique],[Measures].[Caption],[Measures].[Level]} ON COLUMNS, NONEMPTY([Dimension1].[Dimension1].[Dimension1]) ON ROWS FROM [Cube]
Parameter2 - Dataset:
WITH MEMBER [Measures].[Unique] AS [Dimension2].[Dimension2].CurrentMember.UniqueName MEMBER [Measures].[Caption] AS [Dimension2].[Dimension2].CurrentMember.Member_Caption MEMBER [Measures].[Level] AS [Dimension2].[Dimension2].CurrentMember.Level.ordinal SELECT { [Measures].[Unique],[Measures].[Caption],[Measures].[Level]} ON COLUMNS, NONEMPTY([Dimension2].[Dimension2].[Dimension2]) ON ROWS FROM [Cube]
Both Datasets are shared Datasets. In the report the first Dataset should filter the second Dataset.
How can i set a Parameter for the second Dataset?
Currently have three subreports, one main report.
Main report has two parameters - SELECTDATE and EMP_ID. Main report sends Order_Nbr to all subreports.
All subreports work perfectly when I only select 1 Employee and 1 date, but if I choose multiple values it blows up.
SQL has the column as an INT. I have both parameters in main report and subreport, SELECTDATE is set as Text with Multiple Values, and EMP_ID is set to Integer with Multiple Values. My queries has my date IN (#SELECTDATE) and emp_id IN (#EMP_ID).
It obviously sends the correct information to the subreports because it works, but I would like it to work with more values being passed. Love the current ability to check and uncheck employees and end of month dates, like it currently is set using the IN function in my query.
Make the Parameters on your sub report non-multivalue, remove any 'Available values' set.
Pass the multivalue parameter from you parent report as a string using the join method
=Join(Parameters!Emp_ID,",")
The EMP_ID parameter will be set to a comma delimited list, which is what a multivalue parameter sends to the query
I'm not sure how this works with text queries, but it works with stored procedures.
If the sub report is also used as a stand alone report you will need to add a new parameter to allow the user to send parameter values to #Emp_Id from a parameter the user can set
I guess you have not set the parameter in the sub report as Multi Select. If you have set the parameter in the sub report as multi select, then you could just send the parameter from the main report to the sub report as it is. See more at here
I used the following solution, which works in SSRS2016. This also works with text parameters.
Like suggested above, pass the parameter as a string to the subreport by JOINing the values.
Join(Parameters!EmpID, ",")
In your subreport, accept the parameter as text.
In the SQL of your subreport, use the string_split function of SQL 2016 to return a table of the values and simply join it to your main query. So basically if your parameter is named "EmpID_Multi" do
... JOIN (SELECT value FROM string_split ( #EmpID_Multi, ",")) mv ON mv.value= ...
Note: You might consider pulling the values into a temporary table for SQL optimization (sometimes the optimizer does funny things...).
I am working on a report that uses multiple sub-reports. I have two parameters: t_driver_pk and BatchID for the report. I have been able to display the data for each driver on a new page in the subreport using page break and repeat header options (all the subreports have been grouped by t_driver_pk). But, then when I go to main report and run it selecting multiple drivers on t_driver_pk parameter. I am getting a single report that combines the data for all those driver. Essentially, I would like to have it displayed as following:
Parameters:
**t_driver_pk**: 5000,4500 BatchID:610
FirstDriver
Subreport1
Subreport2
Subreport3
Subreport4
Second Driver
Subreport1
Subreport2
Subreport3
Subreport4
Any help would be greatly appreciated. Thanks in advance!
Have you tried adding a Dataset to the report that is driven by the selected t_driver_pk values (i.e. if 5000 and 4500 are selected in the parameter then the new dataset returns the same values).
You should be able to use this dataset with a List data region, which you can insert your subreports into and then pass the current value of t_driver_pk from the new dataset to the subreports. That should repeat them for each value of t_driver_pk.
I have a report ("main report") from where I can reach a drillthrough report that has a multivalue parameter "Product". The parameter has labels and values like follows:
Product A [Product].[Product]&[1]&[1]
Product B [Product].[Product]&[1]&[2]
Product C [Product].[Product]&[2]&[1]
Coming from the main report, in the drillthrough report I would like to select all parameters whose values start with
[Product].[Product]&[1]
Currently, in the main report I load a dataset with all products of this type, fill them into a multivalue parameter and hand the value of this parameter over to the drillthrough report. My question is, is there an easier way to achieve the goal.
It is possible to use only one dataset with all products in the main report and to filter them:
=Filter(Parameters!Product.Value, "[Product].[Product].&[1]", true)
The filter function will look for the expression inside the multiple product parameters and return all starting with this expression.