Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
143 views
in Technique[技术] by (71.8m points)

sql server 2008 - 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

question from:https://stackoverflow.com/questions/19840813/using-the-in-operator-to-filter-in-reporting-services

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...