[英]using an expression to show or hide rectangle based on a parameter value (SSRS)
Trying to show/hide a couple of rectangles in SSRS based on an expression which uses the value of a parameter in the report. 尝试根据使用报表中参数值的表达式在SSRS中显示/隐藏几个矩形。 See the screenshots for more details.
有关更多详细信息,请参见屏幕截图。 When the '-Cover pages' label is picked I want it to display the rectangle but I consistently get the following errors.
当选择“ -Cover pages”标签时,我希望它显示矩形,但始终出现以下错误。 It can't seem to convert and read the parameter expression no matter what I do.
无论我做什么,似乎都无法转换和读取参数表达式。
The expression I'm trying to use is: 我尝试使用的表达式是:
=iif(Parameters!specparam.Value="-Cover Pages",true,false)
It looks like the label of your parameter is what you're looking for based on the image provided and your expression. 看起来您的参数标签是根据提供的图像和表达式查找的内容。 Try to switch instead to:
尝试改为:
=IIF(Parameters!specparam.Label="-Cover Pages",TRUE,FALSE)
(Note: I switched specparam.Value
to specparam.Label
. (注意:我将
specparam.Value
切换为specparam.Label
。
Your comment is very close. 您的评论非常接近。 Apply this expression to the
Hidden
property of the rectangle: 将此表达式应用于矩形的
Hidden
属性:
=IIF( Parameters!specparam.Label.Equals("-Cover Pages"), FALSE, TRUE )
You'll notice I have switched around the FALSE
and TRUE
as you don't want the rectangle to hide when the parameter matches. 您会注意到我已经切换了
FALSE
和TRUE
因为您不希望在参数匹配时隐藏矩形。
Edit: As you're dealing with a multivalue parameter, you can use a combination of Array.IndexOf
and Split
to check if your value is one of the selected parameters. 编辑:在处理多值参数时,可以结合使用
Array.IndexOf
和Split
来检查您的值是否为所选参数之一。 Apply this expression to the Hidden
property of your rectangle: 将此表达式应用于矩形的
Hidden
属性:
=IIF( Array.IndexOf( Split( Parameters!specparam.Value, "," ), "-Cover Pages" ) > -1, FALSE, TRUE )
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.