Working with System.Collections.Generic.List

Posted by Wolfgang Schölmberger on 26-Sep-2016 08:05

Hi everybody,

OE11.6 - Win8

I have to access DocuWare using their new .NET-libaries. As I’m totally new to this type of programming, I really would appreciate some help from OO-guys.

There is a Docuware-class called “Organizations”, which has a method “GetFileCabinetsFromFileCabinetsRelation”. This method returns another class “FileCabinets”, which seems to be a System.Collections.Generic.List.

DEF VAR fcs AS CLASS Docuware.Platform.ServerClient.FileCabinets.

DEF VAR cab AS CLASS Docuware.Platform.ServerClient.FileCabinet.

 ASSGIN fcs = organization:GetFileCabinetsFromFileCabinetsRelation().

 

The “FileCabinets”-class has only one property: “FileCabinet”, and when I look at it I see:

MESSAGE fcs:FileCabinet VIEW-AS ALERT-BOX

--> System.Collections.Generic.List`1[Docuware.Platform.ServerClient.FileCabinet]

 

…and here I’m absolutely stuck, I know that there are 2 cabinets available, but have absolutely no clue how to access them. All I found out until now is that I can define another variable:

DEF VAR cab-array AS CLASS “System.Collections.Generic.List<Docuware.Platform.ServerClient.FileCabinet>”.

 

For the last couple of hours I was reading through the OE11.6-documentation about accessing .NET-arrays, List(T)-classes, collections…., but I got even more confused. So if somebody could provide some code-snippets I really would appreciate it

Posted by Wolfgang Schölmberger on 27-Sep-2016 02:33

found the solution:

cab-array = organization:GetFileCabinetsFromFileCabinetsRelation():FileCabinet.

All Replies

Posted by Mike Fechner on 27-Sep-2016 01:16

So when you have the reference to the list in cab-array, you should be able to access the items with

cab-array[0] and cab-array[1]

cab-array:Count returns the number of items.

DO i = 0 TO cab-array:Count - 1:

 MESSAGE cab-array[i]:ToString().

END.

iterates the items. Or (github.com/.../foreach.i):

{Consultingwerk/foreach.i Docuware.Platform.ServerClient.FileCabinet oItem in cab-array}

 MESSAGE oItem:ToString() .

END.

Posted by Wolfgang Schölmberger on 27-Sep-2016 02:20

the problem seems to be, that I don't have the reference to the list at all (and I have no idea how to get it. I just "defined a class-variable", nothing more).

MESSAGE cab-array:COUNT VIEW-AS ALERT-BOX

--> gives error  3135 - Invalid handle - not initialized or point to a deleted object.

Posted by Wolfgang Schölmberger on 27-Sep-2016 02:33

found the solution:

cab-array = organization:GetFileCabinetsFromFileCabinetsRelation():FileCabinet.

This thread is closed