Hidden Parameter is missing a value - ssrs-2012

In my report, i have created a xxx parameter which takes values from the report data set.
xxx parameter is not being passed to stored proc which is used to show the data for the report.
Now When the report does not have any data for other parameters, i get an error saying xxx parameter is missing a value.
I tried allowing blank values in the parameter properties.

Check that parameter's - Available Values by going to report parameters properties.
It must not be specified any values. So we should set it as None
Another way is,
Just add a blank space at Specify values - in Default values inside report parameters properties.
Third way
Ido an "if exists" statement for this to go away. It worked for me because it makes it always return a value even if that value is not need by my query.
if exists (my select query)
my select query
else
select '2'
// '2' would never be used, but it made ssrs stop giving me
// the stupid error and execute
This should help.

Related

How pull in fields value from created parameter

I created a parameter [GroupID] that is used to query several datasets in my SSRS report. It is using the field [GroupID] from my GroupList_Rolling12 dataset. An example of [GroupID] is 77610N. When 77610N is selected, all of my datasets are correctly 'filtering' for this [GroupID].
I now need to create a text box that returns the [GroupName] of [GroupID]. In other words, when 77610N is selected from my GroupID parameter, I want the [GroupName] that is associated with the selected GroupID parameter to display.
I'm still very new to SSRS and cannot figure this out. I tried creating the expression =First(Fields!GroupName.Value, "GroupList_Rolling12") but that did not work since it simply returns the first value from the query.
I also tried =First(Parameters!GroupID.Value(0)) but this also did not work
I also tried this expression =Lookup(Fields!GroupID.Value, Fields!GroupID.Value, Fields!GroupName.Value, "GroupList_Rolling12")
)
Can you please help?
You can reference the parameter label directly like this
=Parameters!GroupID.Label
There is no need to put the index on the end (=Parameters!GroupID.Label(0)) unless your parameter is multi-value, in which case it would select the first selected entry.

SSRS show parameter values in header

I am trying to add an expression in header section, which would display parameter value chosen by users (if everything selected, display "ALL" instead). I am having trouble with "Property" parameter.
Report structure:
Report is a matrix report that shows data by year and grouped by refBuildingID. Parameter "Property" is based on RefBuildingID. I want to show these parameter values in header when users run this report.
Expression:
=IIF(Countrows("BuildingID")=(Parameters!refBuildingID.Count),"All",Join(Parameters!refBuildingID.Value,", "))
Error:
The Value expression for the text box ‘Textbox31’ has a scope parameter that is not valid for an aggregate function. The scope parameter must be set to a string constant that is equal to either the name of a containing group, the name of a containing data region, or the name of a dataset.
Is there a way to get around this error?
Try this method:
=IIF(Count("BuildingID")=Count(Parameters!refBuildingID.Value),"All",Join(Parameters!refBuildingID.Value,", "))
i think CountRows will work
=IIF(COUNTROWS("BuildingID").Equals(Parameters!refBuildingID.Count),"ALL",Join(Parameters!refBuildingID.Value,", "))

ssrs nullable parameter is demanding a value

Building a report in VS2013. I have a parameter that needs to be able to be null. I can successfully run the report in the query builder, with a null parameter value. But if I run the report in preview or deployed, there is no NULL check box next to the parameter select, so it demands a value.
My stored proc has an optional parameter and it is coded to accept null in the where clause:
spAccomplishedSummaryGet #BurnType char = NULL
...
AND ((r.BurnType = #BurnType) OR #BurnType IS NULL)
The burn type parameter gets its values from a query. I have selected "allow null"
I'm sure I can add a 'null' value to the burntype list, but before I do that I wanted to see if there is a better way.
You need to allow null values against that parameter in SSRS report, and optionally assign null to that parameters as well. Please look at the following steps.
Navigate to "Report Data" option in your SSRS report
under "Parameters" you will see all the parameters that your stored procedure will be demanding, open the parameter properties of that particular parameter which you wish to pass null value (right click on parameter and select option "Parameter Properties").
In the new window under that "General" tab, check the option "Allow null value"
Click here in case of ambiguity
I have had similar issues especially when setting up subscriptions where it requires a value for a parameter that should be able to be left NULL. Rather than using NULL to ignore the parameter, consider using an "All" value in your list of available values. You can easily change the where clause to account for that:
AND (r.BurnType = #BurnType OR #BurnType = 'All')
I have found that this is actually more user-friendly than having a checkbox to essentially disable a parameter.

IIF Statement in TablixFilter issue

I'm trying to filter a matrix in my report. I have names of 4 drivers and I want the Matrix5 to show the name of a default driver in case SELECT ALL is checked in filter. Otherwise I want the matrix to show whoever is checked.
I set an expression at matrix filter as;
=IIF(Parameters!Sofor.Count=4,"abcdef",Parameters!Sofor.Value)
-abcdef is the name of the default driver for the tablix
-Sofor is the driver name parameter and has 4 total possible name options, 5 if we consider SELECT ALL too.
It works well if I check SELECT ALL but stops working if I select only one option.
Error I'm getting is as follow;
"The processing of FilterExpression for the tablix "Tablix5" cannot be performed. Cannot compare data of types System.String and System.Object[]. Please check the data type returned by the FilterExpression"
Though the error sounds pretty self explanatory I still can't understand what I'm doing wrong. Any help please?
Parameters!Sofor.Value is an array of values (the object) because its a multi-select parameter. (what happens when the user chooses 2 drivers?)
Try
=IIF(Parameters!Sofor.Count=4,"abcdef",Parameters!Sofor.Value(0))

How do I set an SSRS Parameter that doesn't have a value to something else?

I have an SSRs Report with a parameter that gets information from SQL. If it hasn't found anything, at the moment it is just empty. Is there anyway to set it such that if it's empty it will return a different value, say "Please Extend Date Ranges" and disable the parameter?
If you using it to fill it using the SQL and using it for only internal purposes then there is option to make the parameter internal and it will be hidden and it will does not prompt the user.
Make a change to the stored procedure or query that populates the parameter. Include some logic so that if no results are returned by the query you are using now, it adds a row with the default label you want.
But no, you can't disable the parameter dynamically, I don't believe.

Resources