Reputation: 2397
I have a report which shows a tablix with too many column. For readability reasons, my user wants to be able to select - when running the report - which columns to select. The user should be able to select from 1, 2, or up to all 9 columns. The columns are static - they are not in the data.
Now, I can make the visibility of a column depend on an expression. I had thought there should be away to have like a boolean array, but that doesn't seem to the case.
I then decided to try assigning values "11", "22", "33"... to each option selected in the parameter, but I was stuck because when asking for the value in the parameter:
=IIF(Parameters!p_ColumnstoShow.Value(0)="11",False,True)
I saw it has a (0)
, and I was all excited thinking that was an array, but then asked for (1)
and it gave me an error it's now part of the array. I'm a bit confused here.
Thanks.
Upvotes: 2
Views: 2728
Reputation: 2397
I found the answer here: http://www.codeproject.com/Articles/11254/SQL-Reporting-Services-with-Dynamic-Column-Reports
You have to be careful, though, that the values selected are not part of any other value. So if one value is, say, John, and another Johnny, you'll be in trouble.
Actually, if you are not using a stored procedure as in that article, but, you are querying the value in the parameter you should use the JOIN function. This is what I'm doing:
=IIF(InStr(Join(Parameters!p_ColumnstoShow.Value),"a")>0,False,True)
=IIF(InStr(Join(Parameters!p_ColumnstoShow.Value),"b")>0,False,True)
=IIF(InStr(Join(Parameters!p_ColumnstoShow.Value),"c")>0,False,True)
=IIF(InStr(Join(Parameters!p_ColumnstoShow.Value),"d")>0,False,True)
Upvotes: 1