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
I don't think you can. The corresponding MSDN documentation mentions that you can use parameters in custom assemblies:
You can reference the global parameters collection via custom code in a Code block of the report definition or in a custom assembly that you provide. The parameters collection is read-only and has no public iterators.
But the examples provided both require you to provide all parameters or just one as an argument to the custom code functions, e.g.
' 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
And:
' 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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With