But then again, I usually do make unreasonable demands. I've used UniObjects (UO) before it became UniObjects.Net (UO.Net) with Classic ASP. I found it simple to use and understand with files and sub routines in ASP. With the introduction of .Net things got a little more complicated to say the least. I was honetly expecting UO.Net to return my data in a dataset or something the .Net list controls would like, but noooooo. Lists of data is returned from UO.Net as either a DynamicArray (UniDynArray) or XML. When being returned from a subroutine, more times than not its a UniDynArray unless the Universe (UV) developer created it as XML. When dealing with a single file, i.e. selecting a subset of parts, putting it to XML is easy and is effective because a DataSet will consume an XML document quite nicely. So how do I get a UniDynArray into a list control like a listbox, dropdownlist, gridview, datalist, datagrid, etc.? Loop it:
Dim uniSession As UniSession = Nothing
Try
uniSession = UniObjects.OpenSession(UVServerIP, UVUserID, UVPassword, UVAccount, UVService)
Dim uniSub As UniSubroutine = uniSession.CreateUniSubroutine("GETSUBJECTS", 6)
uniSub.SetArg(0, common.CompanyCode)
uniSub.Call()
' The subroutine has its own error management
If uniSub.GetArg(1) = "1" Then
Throw New Exception("Subroutine returned error: " & uniSub.GetArg(2))
End If
Dim uniList As New UniDynArray(uniSession, uniSub.GetArg(3))
Dim arr As New ArrayList
' And here's the loop
For i As Integer = 1 To uniList.Count(1)
arr.Add(New LeftNavItem(uniList.Extract(1, i, 0).ToString, uniList.Extract(2, i, 0).ToString))
Next
' Then load it into whatever you want
_leftnav = arr
Catch ex As Exception
_error = ex.ToString
Finally
UniObjects.CloseSession(uniSession)
End Try
Surprisingly enough, its not as much of a server performance hog as I was expecting. It took me a long time to figure this out, and since the universe forums are pretty dead most of the time, it was painstakenly slow. My IBM support rep helped a ton and we figured it out. But as with anything, once you know how to do it it gets easier and easier.
Writing to Universe is even more fun... I'll be posting that soon, as soon as I figure it out!