RTC Forums

Subscription => Support => Topic started by: mastinfo on July 05, 2018, 11:13:30 AM



Title: Passing a Tlist object to an RTC function. Possible ?
Post by: mastinfo on July 05, 2018, 11:13:30 AM
Hello,

i'm wondering if is possible to have as parameter for and RTC function a Tlist object (system.Generics.collections) and how.

The class is defined as follow:

   Tmyrec=record
     field1:string;
     field2:string;
     something else ....
   end;

   Tmyrecords=class(TList<Tmyrec>)
   end;


thanks in advance

Roberto


Title: Re: Passing a Tlist object to an RTC function. Possible ?
Post by: mastinfo on July 05, 2018, 11:47:32 AM
Maybe i have found the solution by myself: i can use an array where each element is a record

Let me know if there's another solution that allow to pass directly the Tlist as parameter.

thanks

Roberto


Title: Re: Passing a Tlist object to an RTC function. Possible ?
Post by: D.Tkalcec (RTC) on July 05, 2018, 12:09:19 PM
You've found the correct solution.

When you have a list of elements without names, you can use an Array ("asArray" = "TRtcArray" class). And if you have a collection of elements where each element has a name, you can use a Record ("asRecord" = "TRtcRecord" class). Since every single element can be of any data type supported by RTC Value Objects (String, Integer, Data, Record, Array, ...), you can create any structure you can think of simply by combining these data types.