I have a multi value parameter I get from a query. I pass it to my dataset and it works like a champ. The dataset parameter uses join, i.e., =JOIN(Parameters!CodeList.Value,",").
So far so good. However when I pass this to a subreport, the subreport seems to only "get" the first item in the list instead of the string.
Also, if I put a textbox on my main report that looks at the CodeList parameter, i.e., =Parameters!CodeList.Value(0), I just see the first item. Using JOIN here returns an error.
I clearly don't get something here. Any available illumination?:)
How about this ?
=Parameters!CodeList.Value(0) gives you the first selected parameter value
=Parameters!CodeList.Value(1) gives you the second selected parameter value
so on
&
Join(Parameters!CodeList.Value,",")
will give you the all selected value for the parameter seperated by ,
Condition is, parameter should exists lol'z.
Assuming that you want it to behave identically to your dataset in this report (I.E. you want to send a string containing all the values in your parameter separated by a comma), you just need to pass the same thing to the SubReport's parameter:
=JOIN(Parameters!CodeList.Value,",")
If what you actually want is for the Parameter in your SubReport to have the same values as the Parameter in your main report, you need to pass:
=Parameters!CodeList.Value
Note the absence of the (0) at the end. The (0) on the end of it will cause it to pass only the first value in the parameter which isn't what you're after.
Related
In SSRS, I have a summary report, and when I click on any figures, it drills through a subreport that generate a list of skus.
I have setup the cells in the summary report and selected all Parameter for the drill through report.
For a multi-value parameter in the subreport, I want to manually select 2 out of 3 available values.
In the textbox property, under Action and parameters, What is the expression to specify the values I want to pass to my subreport?
1,2 - If your parameter is a integer. Don't use the expression with an equals sign, just 1,2 in the parameter value.
If your parameter is a string, I believe you need to double the double quotes.
""1"",""2""
You could also use the SPLIT function to create a string array from the hard-coded values:
=Split("1,2", ",")
Neither formula worked, but at the end, I just modified the list of available value on the subreport and added another value. Then, in the dataset query, I adjusted the WHERE clause so that when the paramater has said value, the field IN ("1","2")
I have a report with one subreport. The subreport is passed a variable, #staffid, to match against a table of employees. If there is no matching staffid, I need the parameter value (#staffid) to display in the subreport. I need to check to see if DisplayName exists for the subreport, and if not, show #staffid in textbox that would ordinarily show DisplayName if there were a match.
Below is a screenshot of the report output right now, but I need to fill in the empty user space with the value passed from the main report if there is no match.
I'm looking for an expression to use in the textbox that basically says, =IIF(ISNULL(Field.DisplayName.Value)),#staffid,Field.DisplayName.Value), but I can't find a combination that works.
Please pass "Parameteres!staffid.value" instead of "#staffid" in sub-report expression as #staffid is a parameter defined in sub-report
Can I use the below expression to pass multiple value in a parameter in subreport?
=Join(LookupSet(1,1,Fields!Name.Value, "DatasetName")," / ")
Will the Join and LookupSet function work in prameter value expression?
No your expression won't work. The Available Values for the Parameter are expecting a single record at a time.
I would create a parameter in the main report with the dataset as DatasetName with the Value of Name. You can set that to Hidden and don't need to use it.
Use that parameter to link to your sub report's parameter.
That should have the same functionality as what you want and would be faster that using the JOIN/LOOKUPSET.
As long as the receiving parameter in the subreport is set to "allow multiple values", you should be able to pass in the lookupset array itself without needing the JOIN function at all.
I have one report with columnName called as 'referenceName'. Two rows get displayed on this report with two different values for 'referenceName' column.
When I am click on the first/second value in the 'referenceName' column only first value gets passed to the next drill through report. Why?
Reason for this error was that I was passing the value of the parameter instead of name of the parameter. so, I was passing '#ReferenceName' instead of [ReferenceName].
I have 2 parameters param1 and param2. param1 has values true and false. My requirement is that if I select true in param1 then param2 should be hidden and if I select false in param1 then param2 should be visible. Can this be achieved in SSRS?
As per Nathan's comment I am adding Amar's comment here as answer/partial answer
Unfortunately, you cannot change a parameter's visibility during run time. Alternatively, you can control the second parameter's values based on the selected value of the first parameter.
Check this post - Hide parameter (dropdown control from the toolbar) in SSRS based on another Parameter
As Amar pointed out you cannot hide parameters dynamically, but what you can do is grey them out for single-value parameters, described here.
For multi-value parameters that won't work, because multi-value parameters are not allowed to be null.
But instead you can modify your DataSet and the default value for the parameter. To limit the user's choice list.
Let me give you an example:
Let's say you have 2 parameters that are cascaded. So you want to choose something from the first parameter and depending on what you choose in the first parameter you get a different result in second parameter. (Microsoft has a documentation about this)
Now we can use this cascading to set the values in the second parameter. So for instance if we choose the value 1 in the first parameter we want the second parameter act normal and show its data to choose from, but in any other case we want the second parameter to have limited data to choose from. And this what I'm going to show. You got a second parameter that looks like this:
In the Available Values we choose the DataSet with its values and labels for the second parameter. Which could look like this:
Now in the DataSet for the second parameter, here DataSet1, we need to specify when to show the limited data and when not:
So what we do is set one label All with the value -1 when the value of the first parameter is not 1 else the DataSet returns all the data from the table/function/stored procedure/ etc.
Lastly the second parameter shall have the default value -1 with the label All chosen when the first parameter is not 1. So back to the second parameter properties. For Default Values the value -1 needs to be specified:
So now the user only gets the preselected All in the list to choose from when the first parameter is not 1. Otherwise the full list will be provided. All that has to be done now is to declare what is done when the value of the second parameter is -1.