Is there any way to access report parameters from within a custom assembly? I can pass them explicitly as part of function calls, but that can be quite cumbersome for very complex reports.
Thanks,
Adrian
Is there any way to access report parameters from within a custom assembly? I can pass them explicitly as part of function calls, but that can be quite cumbersome for very complex reports.
Thanks,
Adrian
我不认为你可以。相应的MSDN 文档提到您可以在自定义程序集中使用参数:
您可以通过报表定义的代码块或您提供的自定义程序集中的自定义代码引用全局参数集合。参数集合是只读的,没有公共迭代器。
但是提供的示例都要求您提供所有参数或仅提供一个作为自定义代码函数的参数,例如
' 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