If Parameter A = (Select All) then Default Parameter B to "Y" - reporting-services

I have a report i have been asked to write from a procedure i did not create the procedure has 2 parameters for each of the options.
#AreaID
#AreaID_All
So They coded this way if you wanted to search for a specific Area id you would input the Area ID into #AreaID and then input "N" Into #AreaID_All.
If you wanted to show all then you would input NULL into #AreaID and "Y" into #AreaID_All.
It was also requested that there be a multiselect dropdown for the #AreaID.
I have this part down, now im stuck on how to say if the User Selected (Select All) in #AreaID then Default the #AreaID_all to "Y".
Any Ideas?

You can create another dataset that returns the count of AreaID rows you are passing as available values to the parameter.
Then use it to compare against the Parameters!AreaID.Count function.
#AreaID_All set expression would be something like this:
=Switch(
...
...
First(Fields!CountofAreaID.Value,"CountDataSet")=Parameters!AreaID.Count,"Y"
)
This means Select All option was select.
Also I strongly suggest you have an internal parameter to validate the data your #AreaID_All is getting from the user.
Let me know if this helps.

Related

SSRS Reporting - show "All" in parameter when the user clicks on Select All option

I'm trying to set the parameter as "All" when the user clicks on "Select All" option in the multi-select parameter. The requirement is to not show all the selected values in the top.
Currently, I'm getting this:
This is the expected value when all are selected:
How to add this requirement? I have tried with adding dataset with "All" value in the table but that is only useful in case I need to display the value inside the report but I need to show it as the parameter in the place where we are selecting parameters.
You can add the 'All' entry to your parameter by UNIONing it in your parameter dataset (it sounds like you have already done this), and then just interpret that in your dataset query.
So your query might then look like this.
SELECT * FROM myTable
WHERE (Result IN (#myParameter) OR #myParameter = 'All')

Report Server: how to select everything if parameter = null or blank (allow multiple values is turned on)

How to return everything in Report Server if parameter value is blank or null?
The solution:
SELECT some_column
FROM your_table
WHERE (#y is null or y >= #y)
Doesn't work in SSRS since "Allow null value" cannot be turned on, when parameter "Allow multiple values" is turned on.
Thank you.
There are a couple of ways around this but the simplest is just to use the "Select All" option at appears at the top of multi-value parameter lists. If you need this to be the default then set the default and available value to the same query.
The "Select All" option is shown automatically for multi-value parameters when there is more than a single value in the list as shown here..
Other ways are similar, for instance you can add a value to the top of your parameter's available values list that has a label called "All" or something like that and a value you can look for in your query (e.g. -1).
BTW: Your sample code would not work with a multivalue parameter if used directly in the dataset query you would normally do something like
SELECT some_column
FROM your_table
WHERE (#y =-1 OR y IN(#y))

ssrs:add null value to multi value parameter didn't work

in order to allow a selection of null value in multi value parameter in SSRS project
we can use the query for the data set
Select ID,Value From SpecificTable
Union All
Select NULL,'Other'
in order to let null value returned from parameter when 'other' string is selected from parameter available selections
note:in available values section at parameters properties i have chosen ID Column as Value Field and Value as Label Filed
i have tried the previous query with no be benefit ,the string 'other' doesn't appear as available selection for the parameter when i preview the report
are there any additional configurations that i should apply ?
I don't think you can do it this way... that's why "Allow Nulls" is an option.. what you can do is set the ID value for Other to some obscure value.. like -99.. which the actual ID from the specifiectable can never be.. and modify your stored procedure to say..
where (#id = sometable.someidcolumn or #id = -99)
This should in effect ignore the ID selection! Unless you want it to do something else of course.. then you code accordingly in the where clause.

Control Column Visibility using DataSet values

My client wants to be able to show/hide columns in a report based on a Parameter (ReportType). The report columns are static, they will just be controlling which ones are hidden/shown which creates a different "View" of it. Currently there are only 2 views, but we are about to add several more.
At the moment column visibility is controlled by simple expression: =Parameters!ReportType.Value = "SOMEVALUE"
and only 1 report type hides columns so this expression is fine.
Now we're moving into a situation where a column may be hidden in multiple ReportTypes and i want to avoid getting into: IF report type = VAL1 or VAL2 or VAL3 THEN HIDE as it will make it very hard to see for any given ReportType what columns are meant to be shown (as all the logic is in each column visibility expression)
I found a post and used the basic elements of it:
http://sql-bi-dev.blogspot.co.uk/2010/10/displaying-dynamic-columns-in-ssrs.html
What im trying to do is define a Dataset, something like:
SELECT * FROM
(
select 'Rpt Type1' ReportType, 'Units' ColumnName UNION
select 'Rpt Type1' ReportType, 'Price' ColumnName UNION
select 'Rpt Type2' ReportType, 'Units' ColumnName
) ReportColumns
WHERE ReportType = #ReportType
And then in the Column Visibility expression check to see if the column name exists in the dataset. This way visible columns for a report type are defined in a single place and are easy to manage/maintain.
In the post i linked, hes getting the user to select the Column names in a parameter. I want to lookup the Names in my dataset based off the ReportType param thats selected.
Im stuck on getting the column names into a parameter and then using that in the column visibility expression. Any help would be much apreciated :)
Doh, i was pretty much there.
I created a parameter and set its default values to "Get From Query" and selected my dataset and ColumnName field... job done!
Then i was just writing visibility expressions for each column using the code in the article i was following.

SSRS Report Builder, is there a way to show values in filter?

Is there anyway to show the user what values are in each field so they can filter on these values?
How is the user supposed to know what values they want to filter if they can't see the values?
If I correctly understand what you are asking:
1) Set up a data set to retrieve the available values for your filter
SELECT DISTINCT MyFieldValue FROM MyTable
2) Create an SSRS parameter which will be used for the user to select a filter. Set it up to allow multiple values, and set the available values to use the data set created in step 1. Let's call this Step2Parameter.
3) Create your core data set for the report, and use the parameter from step 2.
Select MyID, MyFieldValue, Name, Blah FROM MyTable WHERE MyFieldValue in ( #Step2Parameter )
You can repeat this with multiple fields.
Does that get you in the right direction?
Also, make sure that in the Parameter Properties (right click your parameter and select Parameter Properties), that "Select Parameter Visibility" in the "General" menu is set to "Visible".