Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using the IN operator to filter in reporting services

Can anyone advise what the syntax should be when using the IN operator within a table filter. I have tried the below but the snytax is wrong:

enter image description here

like image 437
JsonStatham Avatar asked Nov 07 '13 16:11

JsonStatham


People also ask

How do I add multiple filters in SSRS?

To add Multiple Parameters in SSRS, right-click on the Parameters Folder present in the Report Data tab will open the Context Menu to select Add parameters.. option. Once you click on Add parameters.. option, it will open a new window called Report parameter Properties to configure the parameter properties.

How can use Reporting Services in SQL Server?

Click Start, then click All Programs, then click Microsoft SQL Server, and then click SQL Server Management Studio. The Connect to Server dialog box appears. If the Connect to Server dialog box doesn't appear, in Object Explorer, click Connect and then select Reporting Services.


1 Answers

I had some troubles with this one as well. Microsofts own documentation states a simple comma delimited list of values in the Value box should work. This is confusing because IT DOESN'T. At least it didn't for me and I am using SSRS 2012 with Visual Studio 2010.

It turns out that when you are using the IN operator, SSRS is expecting an array of values. There are a number of ways you can make this work for the filter. The following examples are meant to be typed out in the expression editor.

The first way (also the way explained in the blog linked below) is to simply type your comma delimited list in a string value and then use the split function on it.

=split("2B,2C",",") 

Or you can derive your list from a multi-value parameter. The multi-value parameter is already an array so all you have to do is reference it via the parameter expression as seen below.

=Parameters!MultiValueParam.Value 

I found out this information via the following blog. http://sqlblogcasts.com/blogs/simons/archive/2007/11/20/RS-Howto--Use-the-IN-operator-in-a-filter-expression.aspx

like image 197
Jordan H Avatar answered Sep 30 '22 06:09

Jordan H