SSRS:如何从自定义程序集中访问报表参数?

时间:2013-08-20 09:23:53

标签: reporting-services ssrs-2008

有没有办法从自定义程序集中访问报表参数?我可以将它们作为函数调用的一部分显式传递,但对于非常复杂的报告来说这可能非常麻烦。

谢谢,

阿德里安

1 个答案:

答案 0 :(得分:3)

我认为你不能。 corresponding MSDN documentation提及您可以使用自定义程序集中的参数:

  

您可以通过报表定义的代码块或您提供的自定义程序集中的自定义代码引用全局参数集合。参数集是只读的,没有公共迭代器。

但是提供的示例都要求您提供所有参数或仅提供一个作为自定义代码函数的参数,例如

' Passing an entire global parameter collection to custom code.
' This function returns the value of a specific report parameter MyParameter.
Public Function DisplayAParameterValue(ByVal parameters as Parameters) as Object
    Return parameters("MyParameter").Value
End Function

' Passing an individual parameter to custom code.
' This example returns the value of the parameter
' passed in. If the parameter is a multivalue parameter, 
' the return string is a concatenation of all the values.
Public Function ShowParameterValues(ByVal parameter as Parameter)
 as String
   Dim s as String 
   If parameter.IsMultiValue then
      s = "Multivalue: " 
      For i as integer = 0 to parameter.Count-1
         s = s + CStr(parameter.Value(i)) + " " 
      Next
   Else
      s = "Single value: " + CStr(parameter.Value)
   End If
   Return s
End Function
相关问题