Using SSRS how do I slide data up if they are null? - reporting-services

I can't figure out how to slide information up in an SSRS report if the data comes back as NULL. So if I've got an address field with the entire address i want to slide data up (remove white spaces) if data is null.

If I Understood what you are trying to achieve then that is You want to filter out the empty values from the report dataset.
There are two ways to do that
1) Set condition in your sql so that filtered data will come to the report
2) Filter data in dataset of report
If you have control over the query then always use first approach, But if you dont have control over it then use below method,
For that you can use the report filter here is more info.
For your purpose you can set the filter expression for the dataset as
1) Expression
= IIF( IsNothing(Fields!address.value) || Len(Trim(Fields!address.value)) = 0 ,False,True)
2) Set filter Operator =
3) Set filter Value to True
That will filter out the empty data

Related

SSRS Multi-Value Parameter - When Select ALL, returns zero rows

My current definitions for this report are like this:
DataSet A = a pretty extensive query with 'AND ai.Channel IN (#ChannelParameter)'
DataSet B = Channel 'Select distinct channel from Account_Info'
result set 'Retail Channel' or 'Wholesale'
Parameter = #ChannelParameter is set to Allow Multiple Values and is Getting the values from Query.
Tablix Properties - Filters
Expression [Channel]
Operator IN
Value =Parameters!ChannelParameter.Value(0)
When I run the report and select 'Retail Channel', I get the correct data.
When I run the report and select 'Wholesale', I get the correct data.
When I run the report and select both values, I get zero rows returned.
When I modify the query for DataSet A to be ai.Channel IN ('Retail Channel','Wholesale'), I get all of the rows. There are no rows in the data where the Channel field is NULL.
I've seen and tried some changes to the expression in the parameter using a JOIN statement, but no better results there.
What am I missing?
You filter expression is incorrect, as you stated (0) that means only the first parameter value will be used.
Having said that, it looks like you are already filtering the data in your A dataset so there is no need for the tablix filter, just remove it.

How to filter a tablix based on paramater but no filter when paramater is null?

I've a tablix with data that comes from a dataset , there is a column called Productgroup and there might be some users that would like to apply a filter on it.
I'm trying to build an ssrs expression that will filter my tablix on that specific column but only when the parameter called #Filter is not null , if null , it does not need to apply filter
I've tried
Expression: Productgroup
Operator: like
Value: =IIF(IsNothing(Parameters!Filter.Value), false, Fields!ProductGroup=Parameters!Filter.Value)
Nothing seems to works :(
First of all, it's best to send your parameters to your dataset and filter on the server, rather than bring back ALL of the data and filter on the client side. So that means parameterizing your stored procedure, or using a WHERE clause to filter the table/view you're connecting to.
If you stick with this approach:
You want your Expression to be "ProductGroup".
You want your Operator to be "=".
You want your Value to be =IIF(IsNothing(Parameters!paramFilter.Value), Fields!Productgroup.Value, Parameters!paramFilter.Value)
What you're doing is saying if the parameter is empty, I need the ProductGroup to be equal to the ProductGroup. That's always true. But if the parameter is not empty, the ProductGroup has to be equal to the parameter value.

SSRS Switch statement expression for multi value parameters

I have the following switch statement within an SSRS report, but it errors out when I run the report.
Basically Parameter 1 is a multi value parameter, and when the parameter has two values selected where they are two distinct values, I want a certain text to appear.
=SWITCH(Parameters!Parameter1.Count = 2 AND Parameters!Parameter1.Value(0) = "TEXT1-NY" AND Parameters!Parameter1.Value(1) = "TEXT2-LA" , "Combined (NY & LA)"
, True, JOIN(Parameters!Parameter1.Label,"& ")
)
Additionally, regardless of the numbers that are selected (i.e if there were 6 parameters that were selected), is it possible that these two parameters would be replaced with that particular text followed by , and then names of other parameter values?
First of all, good job working out the expression that you have. You're on the right track, but expressions don't have a programmatic way to loop through the values of the parameter.
One option to do specifically what you asked would be to add a custom function to the Code section of your report that could loop through the parameter values.
Another option would be to simply UNION this "Combined (NY & LA)" value to your dataset so that it is available as one of the options.

Dynamic groupings using IIF with multiple datasources

I'm using report viewer and trying to create dynamic groupings on my table. Before the report is generated, I have a popup that ask if the report generated should be grouped by category or not.
I have two datasets, one called ReportParameterDTO and the second is called LoanDTO
The tablix is connected to the dataset LoanDTO. I want to create a parent grouping expression for that tablix such that if the first value of ReportParameterDTO.GroupByCategory is true, then it should group, otherwise do nothing.
What I tried
=IIF(First(Fields!GroupByCategory.Value, "ReportParameterDTO") = true, Fields!Category.Value, ""))
It gives me back and error around Fields!GroupByCategory.Value and the error within the error list states that A group expression for tablix includes an aggregate function.
The IIF Expression will compile if I use Field Values from LoanDTO but I don't want to do that.
Add a new parameter.
Set it to Internal.
Set the Available Values to pull from the ReportParameterDTO dataset and the Value field will be GroupByCategory.
Also set the Default Values to pull from the ReportParameterDTO query.
Now you can refer to this internal parameter in your grouping expression like so:
=IIf(Parameters!GroupByCategory.Value = True, Fields!Category.Value, Nothing)
You can create both table and whit your parameter show or hide the table visibility. So like this I think is going to be more easy for you to set up your table and groups.

SSRS 2008 R2 Parameter filter using mutivalue textbox

In SSRS 2008 R2, is it possible to have a parameter that looks for specific data inside a cell?
For example:
I have expression (Fields!input_criteria.Value) which contains multiple values separated by ;#
;#Action01;#Action02;#Action03;#Action04;#Action05;#
Depending on the row the cell can be populated with different combinations
Row 1 = ;#Action01;#Action04;#Action05;#
Row 5 = ;#Action01;#Action05;#
Row 7 = ;#Action03;#
...
I want to create a Parameter to filter the dataset by looking into Fields!input_criteria.Value and display the rows with the value selected
Available Values:
Action01
Action02
Action03
Action04
Action05
If I select Action01 from the Parameter drop down the report displays only Rows 1 and 5. If Action04 is selected only Row 1 is displayed.
Thanks in advance for the help!
You can set the filter on your dataset
1) Write custom code that will accept two parameters one is your parameter selected value separated by comma. You can join your values using
=Join(Parameters!input_criteria.Value.Value, ",")
second is your input_criteria field value
2) The method will split the parameter value and loop through the each value and and then using InStr it will determine if the calue is present in input_criteria field. If present then it will return true.
3) In filter set the expression as
= Code.Yourfunction(Join(Parameters!input_criteria.Value.Value, ","),Fields!input_criteria.Value)
4) In filter Set the operator to =
5) In filter Set the value to the True
That will filter all your records which contains your selected parameter values.
You can add the custom code in Report by going into menu bar options,
Report->Report Properties -> Code
You can just use Instr() function in your filter.
=InStr(Fields!input_criteria.Value,Parameter!param1.Value)
>
0