" /> Statservice SDK - Problem using converting sample c# code to vb.net - Genesys CTI User Forum

Author Topic: Statservice SDK - Problem using converting sample c# code to vb.net  (Read 3015 times)

Offline hynsey

  • Newbie
  • *
  • Posts: 14
  • Karma: 0
Advertisement
[b]EDIT - Just realised this should probably be in the Developer Forum, so please feel free to move! Sorry!![/b]

Hi all,

I'm using vb.net to code a stats retrieval app. I'm having a problem with casting one of the types used for creating the statistics object for retreiving some stats. I have added 2 web references to the project:

[b]GIS_SessionService

GIS_StatService[/b]

I can login and get a session ID fine. The issue is with code to build the stat. I've copied this code from the c# example in the 7.1 stats sdk developers guide, and tried to modify it to work in vb.net.

In this code within my sub:

[code]        Dim statistic As New GIS_StatService.statistic()
        statistic.statisticId = "statref1"

        Dim objectIdType As New GIS_StatService.objectIdType()
        System.Console.WriteLine("Statistic needed for Agent1961")

        objectIdType.id = "icstest02"

        objectIdType.tenantName = "Resources"

        statistic.objectId = objectIdType
        'Then build metric data.
        Dim metric As New GIS_StatService.metric()
        Dim statisticType As New GIS_StatService.statisticType()

        'objectType[] ot = new objectType[]{objectType.Agent};

        Dim ot As New GIS_StatService.objectType()
        statisticType.objectType = ot[/code]



I get this error on the last line, with ot highlighted:

[b]Value of type 'GIS_Connect.GIS_StatService.objectType' cannot be converted to '1-dimensional array of GIS_Connect.GIS_StatService.objectType' [/b]

Any help is greatly appreciated, I must be casting the object 'ot' incorrectly but I'm not sure how to cast it correctly.

Thanks,

Mick
« Last Edit: October 21, 2008, 01:17:28 PM by hynsey »

Offline René

  • Administrator
  • Hero Member
  • *****
  • Posts: 1832
  • Karma: 62
Re: Statservice SDK - Problem using converting sample c# code to vb.net
« Reply #1 on: October 21, 2008, 09:21:47 PM »
Hi Mick,

The value of "statisticType.objectType" has to be 1-dimensional array of instances of the class "objectType". Below is code sniped but I haven't been able to test as don't have access to GIS now.

[code]Dim ot() As new GIS_StatService.objectType={objectType.Agent}
statisticType.objectType = ot[/code]

R.

Offline hynsey

  • Newbie
  • *
  • Posts: 14
  • Karma: 0
Re: Statservice SDK - Problem using converting sample c# code to vb.net
« Reply #2 on: October 22, 2008, 10:07:29 AM »
Hi Rene,
Thanks for the response. I've put your code line in there, but now I get the following errors:

[code]={objectType.Agent} [/code] is underlined with the message "expected end of statement"

[code]ot[/code] is underlined with the message "Name 'ot' is not declared"

Hope you can help further! :)

Thanks,
Hynsey




Offline hynsey

  • Newbie
  • *
  • Posts: 14
  • Karma: 0
Re: Statservice SDK - Problem using converting sample c# code to vb.net
« Reply #3 on: October 22, 2008, 10:16:46 AM »
Hi Rene,
I modified the code to this:

[code]Dim ot() As GIS_StatService.objectType = {GIS_StatService.objectType.Agent}
        statisticType.objectType = ot[/code]

and it works now! Thanks for the help!! :)

Cheers,
hynsey