![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi, Environment: VB.net, WebServices, Universe 10.1 |
#3
| |||
| |||
|
|
Hi, Environment: VB.net, WebServices, Universe 10.1 In VB.net I create a function that returns a SelectList: Function getUVselectList(ByVal SelectStatement As String, ByVal iSelectListNum As Integer ) As IBMU2.UODOTNET.UniSelectList Dim cmd As UniCommand = Nothing 'UNIOBJECTSLib.UnioaifCtrl Dim uniSelectList As UniSelectList cmd = UniSession.CreateUniCommand() cmd.Command = "CLEARSELECT" cmd.Execute() cmd.Command = SelectStatement cmd.Execute() uniSelectList = UniSession.CreateUniSelectList(iSelectListNum ) Return uniSelectList end function I call the function elsewhere: Dim MySelectList As UniSelectList MySelectList = getUVselectList("SELECT PATIENTS WITH STATUS>5", 0) and iterate through the MySelectList. (Note the param iSelectListNum=0) This is working OK. 2 questions: Q1: if I call the getUVSelectList function and assign the resulting select list to another UniSelectList var - call it MySelectList2. That is: Dim MySelectList2 As UniSelectList MySelectList2 = getUVselectList("SELECT VISITS WITH PTID=1", 1) while iterating through the original MySelectList then I get the MySelectList select list screwed up. I thought that passing a new value (iSelectListNum=1) param in the function would allow for 2 (or more) SelectLists to be resident in memory simultaneously? But it appears not - or have I done something wrong? Q2: (flows from the above) To fix the above problem, I return a DynamicArray rather than a Selectlist. Thus my function now becomes: Function getUVselectList(ByVal SelectStatement As String, ByVal iSelectListNum As Integer ) As IBMU2.UODOTNET.UniSelectList Dim cmd As UniCommand = Nothing ' UNIOBJECTSLib.UnioaifCtrl Dim uniSelectList As UniSelectList cmd = UniSession.CreateUniCommand() cmd.Command = "CLEARSELECT" cmd.Execute() cmd.Command = SelectStatement cmd.Execute() uniSelectList = UniSession.CreateUniSelectList(iSelectListNum ) Dim dynArr As UniDynArray dynArr = UniSession.CreateUniSelectList(iSelectListNum).Rea dList uniSelectList = Nothing Return dynArr end function As I understand it, the UniSession.CreateUniSelectList(iSelectListNum).Rea dList is a "singleton" - thast is it is processed by U2 once and returns a dynamic array. Then I can iterate through the dyn array to get to each value. The alternative is to return a SelectList. However, the select list (appears) to be something of a pointer (or a row set cursor from SQL) and means that the app is tieing up the U2 processor. Thus I would assume that the return of a dyn array is more efficient than a select list - correct? Thanks for your patience and assistance. cheers Terry |
#4
| |||
| |||
|
#5
| |||
| |||
|
|
Terry - The reason it appears not to work is because you also need to tell the select command which select list it is going to. you need to append on the end of the command TO selectlistno, so that the command becomes say 'SELECT VOC TO 2' e.g. cmd.Command = SelectStatement & " TO " & iSelectListNum Rgds Symeon. |
![]() |
| Thread Tools | |
| Display Modes | |
| |