VBScript passing an array into SSRS VB code
Within SQL Server 2005 Reporting Services I am attempting to evaluate an expression which outputs an array which I attempt to pass to my VBScript code with my report. My parameter values are BU MC CD DU
The join function correctly outputs the string BU-MC-CD-DU
I then use the split function within an expression to split the values and output as an array as such
=Split(join(Parameters!ReportType.Value,"-"),"-",-1,1)
After which I then pass the array to my VBScript code within the report using the expression below within a textbox :
=Code.debugReportVisible(Split(join(Parameters!ReportType.Value,"-"),"-",-1,1))
My VBScript function is as follows
function debugReportVisible(pSelectedReports() ) as String
dim debug as String
debug = CStr(pSelectedReports(0))
end function
The code 开发者_如何学运维does not error but no value is displayed in the textbox.. Can someone tell me why this is?
Many Thanks,
So I ended up just passing the the hypen (-) seperated string to the 'isReportVisible function' from my join expression defined for the hidden property of each subreport (for e.g the BU sub report visibility hidden expression is as below)
=Code.isReportVisible(join(Parameters!ReportType.Value,"-"),"BU")
function isReportVisible(pSelectedReports as String, pSubReport as String) as Boolean
dim hidden as Boolean
dim reportArray
dim counter
hidden = true
counter = 0
reportArray= Split(pSelectedReports,"-")
for counter = 0 to UBound(reportArray)
If reportArray(counter) = pSubReport Then
hidden = false
End If
Next
return hidden
end function
Hope this helps someone....
精彩评论