Quantcast
Channel: SQL Server Reporting Services, Power View forum
Viewing all articles
Browse latest Browse all 10045

Calling a Web Service in a SSRS Report - Error Converting String to Generic List of Strings

$
0
0
Hello,

I am using SSRS version 2005 and am trying to call a web service to retrieve data for a SSRS report.  I've looked on Google and MSDN for the past 2 days and have exhausted all options.  Here are the details...

The web service method I am calling accepts 4 parameters...

Parameter 1 = Generic list of strings
Parameter 2 = DateTime
Parameter 3 = Int
Parameter 4 = Int

I have created a function (on the CODE tab in report properties) in my report that gets passed a comma delimited string and returns a Generic List of Strings that I use to format Parameter 1.  The code for the function is as follows:

Public Function GetIDs(ByVal IDList as String) As List(Of String)
   Dim stringArray() = IDList.Split(",")
   Dim genericList As New List(Of String)(stringArray)
   Return genericList
End Function

I am passing a string to the function that looks something like this:

"1,2,3,4"



When I try to PREVIEW the report, I get an error that reads:

"There is an error on line 0 of custom code: [BC30002] Type 'List' is not defined"



I've tried changing the function declaration to pass back a string array:

Public Function GetIDs(ByVal IDList as String) As String()
    Return IDList.Split(","c)
End Function

This returned the error (from the web service): 

"Error in line 5 position 22.  Expecting state 'Element'.. Encountered 'Text' with name ", namespace"



I have also tried changing the function declaration to pass back an array: 

Public Function GetIDs(ByVal IDList as String) As ARRAY

This also produced the error:

"Error in line 5 position 22.  Expecting state 'Element'.. Encountered 'Text' with name ", namespace"



I know that this particular web service method DOES work because it is coded to accept nulls in the first parameter.  So... when I call the method with nulls, it returns a recordset of ALL data (this works fine).  Only when I pass a string to the function (which "filters" the recordset by the ID list), does the error occur.

Is SRSS limited with respect to VB.NET code so that the List(Of String) statement is not recognized?  Has anyone done this before and if so, how did you convert a comma delimited string to a Generic List of Strings within a function in the SSRS report?

Any info would be greatly appreciated.

Thanks!

Bob


Viewing all articles
Browse latest Browse all 10045

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>