Title: Function with array result Post by: bebeantics on January 19, 2017, 06:26:41 PM Hi
1. I have a server-side function whose result is array. var aa:trtcarray begin .... aa.asstring[0]:=... aa.asstring[1]:=... .. aa.asstring[4]:=... ... result.asarray:=aa; (IS CORRECT?); 2. On the client side when calling the function, after reception i test the result type in this way. try with dt.RtcClientModule1.Data.NewFunction('userinfo') do begin eue1:=utf8encode(eu1); eue2:=utf8encode(eu2); crypt(eue1, formatdatetime('dd.mm.yyyy', now)); crypt(eue2, formatdatetime('dd.mm.yyyy', now)); asstring['uss']:=eue1; asstring['pass']:=eue2; end; finally myres:=dt.rtcclientmodule1.execute(false); end; if myres.isType=rtc_array then bb:=myres.asarray <-------------------This is corect? else if myres.isType=rtc_exception then showmessage(myres.asString); <------------(xxx)-------Access violation at address 00774E07 in modules ..... Read of address 00000000 I receive the (xxx) value The final question is how correctly i use the array in this tipe of situation? Title: Re: Function with array result Post by: D.Tkalcec (RTC) on January 19, 2017, 06:52:53 PM On the Server, if you want to use a local TRtcArray variable to prepare your array instead of directly using the "Result" object, you can do it like this:
var aa:trtcarray begin aa:=Result.newArray; aa.asstring[0]:=... aa.asstring[1]:=... For more information on writing remote functions on the Server and calling them from the Client, please read this collection of FAQ topics (https://rtcforum.teppi.net/index.php?topic=311.0). Best Regards, Danijel Tkalcec Title: Re: Function with array result Post by: bebeantics on January 19, 2017, 08:01:36 PM Thank you
But I found nothing about rtcarray's. Title: Re: Function with array result Post by: D.Tkalcec (RTC) on January 19, 2017, 08:40:06 PM Here is a direct link to the FAQ topic about RTC Remote Functions - working with flexible structures (http://realthinclient.com/sdkarchive/index2ccb.html), which shows how to work with rtcRecords, rtcArrays and rtcDataSets - on Client and Server side.
Best Regards, Danijel Tkalcec |