Search code examples
web-servicesreporting-servicesssrs-2008ssrs-2012rdl

How to Replace the Web Service domain part URI with a variable name


I have this function in my .rdl report,

 Public Function GetBarcodeAddress(datastring As String, serverName As String) as String
    GetBarcodeAddress=String.format("http://serverName/barcode/barcode.ashx?data={0}", datastring )
    End Function

originally it was, "localhost", but i want to make it dynamic by the value to be passed in servername depending on the servername

 Public Function GetBarcodeAddress(datastring As String) as String
    GetBarcodeAddress=String.format("http://localhost/barcode/barcode.ashx?data={0}", datastring )
    End Function

But when I updated the report, no barcode was generated.

but my manually running the URI, it worked, but when in the actual report, no barcode is generated.

AM I RIGHT IN JUST PUTTING THE VARIABLE NAME in the domain name part?


Solution

  • For that to work you would need:

    Public Function GetBarcodeAddress(datastring As String, serverName As String) as String
        GetBarcodeAddress=String.format("http://{0}/barcode/barcode.ashx?data={1}", serverName, datastring)
    End Function
    

    Ref: https://learn.microsoft.com/en-us/dotnet/standard/base-types/composite-formatting?view=netframework-4.7.2