I am using a split_string delimiter to be able to choose from multiple values from the SSRS report. I am able to select Multi Values in the SSRS report but the SSRS displays #Error where the multi value should be.
Picture for reference
This is what my expression for the report looks like
The count and ismultivalue in the expression works just fine
For Example:
I am using isMultiValue in the expression and it works fine
but Label and value throws #Error
In your report expression you are referecing the Parameter rather than the value that is passed to your Dataset, so successfully using a string_split function in the Dataset is actually unrelated here.
This is because multi valued parameters are Objects and not simple scalar values. When you do a count on the Parameter you are counting the items in the Object, which is a valid operation.
However, the Parameter object can't show you a single Value or a Label as it doesn't know which Value or Label to show you, even if there is only one item in the Parameter object.
What you need to do instead, is use a zero based Index value to specify which item you want to display:
="Bkt: " & Parameters!BKT.Label(0)
or tell SSRS to display all the items within the Parameter object as a list:
="Bkt: " & join(Parameters!BKT.Label,", ")
Related
I have a stored procedure which drops either 1 or 2 columns from the result set. In my SSRS report, I have all possible columns that may come from the result set as dataset fields. I am trying to use the IsMissing function to change the column visibility, but it is not working. How can I make this functionality work?
I tried using examples from
https://sqlserverbi.blog/tag/hide-columns/
and
https://www.allaboutmssql.com/2013/01/ssrs-ismissing-visibility-function.html
where I right click the column, select Column Visibility and add an expression to the Show or hide based on an expression line.
Here is how I have been trying to use the expressions:
When I want to hide 2 of the columns I use:
=Fields!LINE_30_A.IsMissing And Fields!LINE_30_B.IsMissing
and when I want to hide only one of them I use:
=Fields!LINE_30.IsMissing
I have also tried the expressions like this:
=IIF(Fields!LINE_30_A.IsMissing And Fields!LINE_30_B.IsMissing,True,False)
I ran my stored procedure in a way that has dropped 1 of the columns from the result set. In this case the expression Fields!LINE_30.IsMissing should have been evaluated and I should be seeing the columns for Fields!LINE_30_A and Fields!LINE_30_B. But I only see the column for Fields!LINE_30 (which shouldn't be showing at all) and the other 2 columns are hidden. I also receive these 2 warnings:
1) Warning [rsErrorReadingDataSetField] The dataset ‘DataSet1’ contains a definition for the Field ‘LINE_30’. The data extension returned an error during reading the field. There is no data for the field at position 11.
2) Warning [rsMissingFieldInDataSet] The dataset ‘DataSet1’ contains a definition for the Field ‘LINE_30’. This field is missing from the returned result set from the data source.
How can I simply hide row based on selected parameter in SSRS 2012.
I have LineGuid parameter that has two values: Earthquake and Wind
I want to hide the row if 'Wind' parameter is chosen, because it shows sum value for Earthquake.
So I am entering an Expression in Row Visibility but it gives me an error saying: "Overload resolution failed because no Public '=' can be called..."
I also tried to pass Value(GUID), not Label but gives me the same error.
What am I missing here?
You have the Line GUID parameter set to accept multiple values. The values are passed in as an array which is why you see the String() syntax in the error message. One option is to change that to not accept multiple values. Another option is to use the First selected value like so:
=Parameters!lineGuid.Value(0)
Note the reference to the array index on the end of the expression.
If you want to combine all the values you can also join them like this:
=Join(Parameters!lineGuid.Value, ", ")
This will concatenate the values in the array into a comma separated string.
Join all of your parameters together, then check to see if Wind is part of the string.
= IIF(InStr(Join(Parameters!lineGuid.Label,","),"Wind") > 0,True,False)
In my case I needed to display row when "Earthquake" parameter is chosen, and also when both parameter chosen: Earthquake and Wind.
This expression made it work:
=IIF(InStr(JOIN(Parameters!lineGuid.Label,","),"E")
OR
InStr(JOIN(Parameters!lineGuid.Label,","),"W")
AND
InStr(JOIN(Parameters!lineGuid.Label,","),"E")>0,False,True)
Try use the actually parameter .value not .label name
The issue:
I'm working on a SSRS report, but have encountered some quite strange behavior when I populate a DropDown (another paramter, named "Group") using a DataSet that uses another parameter that is passed in through the URL.
The problem is that I want the Group-parameter to be updated from the URL parameter TrackerTypeID, which works absolutely fine in other cases. Though this is the first time I have a parameter depending on another parameter in its DataSet.
However if I have TrackerTypeID as a visible parameter and manually change the integer value of the parameter the DropDown parameter (Group) is updated accordingly.
What I've done:
So I have a hidden parameter that is passed in through the URL called TrackerTypeID. This parameter is then used in the where-clause of the DataSet that populates another parameter:
SELECT
ID,
TrackerGroupDescription
FROM
vw_TRK_TrackerGroup_LK
WHERE
TrackerTypeID = #TrackerTypeID
Union SELECT Null, '-- Select All --'
As you may suspect it uses the Available Values in Parameter properties to set the available values from a query.
What I expect to happen:
As you might have already suspected I wish for the DropDown parameter to be
I got the Tumbleweed badge for this question.... :)
I've moved on a little from the original question but still looking at using internal/hidden parameters, this time passing to another report which runs a stored procedure (which sends an email).
The main report (report A) has a parameter called StudentCourses (originally called ReportParameter1) which I have tried both as Hidden or Internal, and currently has ticked Allow blank value and Allow multiple values.
(Its default value is a field from the result of a query, which shows the courses a student is enrolled on).
Action for my textbox no longer goes to URL (to open PHP form) but now uses Go to report to call report B. Under action options I've added two parameters; StudNetworkID and StudCourses. The number of courses can vary from 2 to 5.
The new report (report B) has two parameters also called StudNetworkID and StudCourses; both are Hidden and StudCourses has ticked Allow blank value. [All parameters are text, btw].
If Report A StudCourses is set to =Parameters!StudentCourses.Value(0) then the first course is shown on Report B. So far so good.
If Report B StudCourses is set to Allow multiple values, then Report B shows #Error and the Warning description given is "[rsInvalidExpressionDataType] The Value expression used in textrun ‘Textbox3.Paragraphs[0].TextRuns[0]’ returned a data type that is not valid."
If Report B StudCourses is set to NOT Allow multiple values and Report A StudCourses value is set to [#StudentCourses] then Report B shows the text "[#StudentCourses]".
If Report B StudCourses is set to Allow multiple values again, then I get the same invalid data type error as before.
Having turned off Allow multiple values on Report B to avoid the #Error issue...
Setting Report A StudCourses to =Parameters!StudentCourses.Value(0) & Parameters!StudentCourses.Value(1) then Report B shows course 1 and course 2 on one line. OK so far.
However, setting Report A StudCourses to =Parameters!StudentCourses.Value(0) & Parameters!StudentCourses.Value(1) & Parameters!StudentCourses.Value(2) gives me a runtime error that the Index was outside the bounds of the array (because there are currently only two courses). On clicking the textbox, Report B just says "The 'StudCourses' parameter is missing a value".
OK...
I turned off Allow multiple values on Report A StudentCourses parameter (the one holding the result from the query) and for the Go to report parameter StudCourses I added the other values, so eventually had value(0) to value(4), the result was interesting. For each parameter value used it gave me a letter from the first course on Report B. Hence when I included up to value(4) it gave me the first five letters of course one!
Yep, ok, this is because it is no longer reading multiple values and so specifying a number just returns the letter from that position.
SO...
How do I allow for up to 5 courses to be passed over???
What follows below is the original question
I have a small report designed in Visual Studio that displays courses that a student is enrolled on. The number of courses can vary from 2 to 5, depending on the student.
Also on the report is a text box, which when clicked will action a url to open a PHP form.
I have worked out how to pass the user id to this PHP form but, if possible, I would also like to pass the course titles.
If I use internal report parameters* I can add these to the url, like this:
="http://myurl/webform.php?param=" & Mid(User!UserID,InStrRev(User!UserID,"\")+1)
& Parameters!ReportParameter1.Value(0)
& Parameters!ReportParameter1.Value(1)
& Parameters!ReportParameter1.Value(2)
& Parameters!ReportParameter1.Value(3)
& Parameters!ReportParameter1.Value(4)
but unfortunately I get the runtime error "The Hyperlink expression for the text box 'Textbox7' contains an error: Index was outside the bounds of the array."
If I just put the first two report parameters it works fine.
I tried using parameter count, e.g. iif(Parameters!ReportParameter1.Count > 2, Parameters!ReportParameter1.Value(2), " "), but I still get the same error.
Please can someone show me how to get around this runtime error, or suggest another way to do this?
Thanks
PS * Report Parameters set up as Text, Allow blank value, Allow multiple values, Internal, Available Values = None, Default Values = Get values from a query; Value field = course title.
I have a multivalued parameter named as Graduation_Year. It is a optional parameter. So I have used the "Please Select" as the default with value 0. Therefore I have used below query to make it optional and filter values only when a real value is entered.
EH.Pwks_year_of_graduation IN (#GradYear) OR 0 IN (#GradYear)
But here user has to de- select "Please Select" get the correct result.
I tried to filter the Graduation_Year parameter using dataset parameter expressions. But it didn't work.
Please suggest a method to filter out the 1st item in the multivalued parameter list (it can be used with below expression).
=iif((Parameters!GradYear.Value(0)="0" And Parameters!GradYear.Count>1)
,**Filtered Parameter value list**
,Parameters!GradYear.Value)
All I want is to remove Parameters!GradYear.Value(0),
when Parameters!GradYear.Count>1
form the multivalue parameter before it is considered in the query.
Thanks
Mathee
You have started off the wrong foot and now you are trying to fix something you shouldn't have done anyway.
The provided value **Please Select** should be a prompt and not a specified value for your parameter.
If you go to the parameter properties there is a property called Prompt specify Please select there.
Now when you execute the report it will show the parameter as follow: