Hello,
I'm trying to create a custom code function for Reporting Services. I would like to have it user-friendly and give the user the ability to pass a report parameter name into the function (so it can be a generic function that can be used for many reports).
Is there a way to do this so inside the code I can have access to other properties of the object?
I envision something like:
Function Blah(ParameterName as String) as String
Dim MaxNum as Integer
Dim ParamValue as String
MaxNum = Reports.Parameters!ParameterName.Count - 1
ParamValue = Reports.Parameters!ParameterName.Value
etc...
Is this possible? I can't figure out how to do this. Using dynamic SQL you can do this very easily by concatenating string values together and then executing the string. Is there something similar to this in VB?
Help! Thanks
Below is an example for a custom code function that you can call in a textbox e.g. as
=Code.ShowParametersValues(Parameters!Country)
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
-- Robert