开发者

How to check if a value is selected in a multi-value parameter

开发者 https://www.devze.com 2023-04-04 07:01 出处:网络
In SSRS 2008, I use Multi-value parameters to, well, select multiple values for a particular parameter.

In SSRS 2008, I use Multi-value parameters to, well, select multiple values for a particular parameter.

In my report I have conditional formatting: a particular label has to be blue if the item is selected; otherwise it will stay black. My intuition was trying it the SQL way - but I was wrong :-)

Switch(
  Fields!groupType.Value = "firstValue", "#00ffffff",
  Fields!groepType.Value = "secondValue", "Tomato",
  Fields!groepType.Value = "thirdValue", "DimGray",
  Fields!groepType.Value IN Parameters!p_myMultipleValueParameter.Values, "Blue"
)
开发者_开发技巧

What is the right way to handle this?


I think the cleanest way is probably the following

Array.IndexOf(Parameters!p_myMultipleValueParameter.Value, Fields!groepType.Value) > -1

Running a join each time may be inefficient because of the overhead of allocating extra strings, especially if the function will be run over a large list, or once per row of a grid, say.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号