如何从多值中选择要在报表中显示的字段
如何从多值中选择要在报表中显示的字段。
引言
有时,客户希望选择需要在报表中显示的字段。SSRS 可以通过多值参数和自定义代码提供此功能。
- 添加一个包含所有需要选择的字段的多值参数。
- 添加一个自定义函数。此函数用于查找指定的字段是否被选中。
- 将列的
visibility
属性表达式设置为“=Not Code.CheckSelect(0)
”。
源代码如下:
public function CheckSelect(byval s1 as integer) as boolean
CheckSelect=false
dim i as integer
i=0
for i=0 to Report.Parameters!Report_Parameter_0.count()-1 step 1
if s1=Report.Parameters!Report_Parameter_0.Value(i) then CheckSelect=true
next i
end function
历史
- 2008年3月17日:初始发布