RTC Forums
April 28, 2024, 11:41:58 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Login Register  
Pages: [1]
  Print  
Author Topic: Function with array result  (Read 4034 times)
bebeantics
RTC License+
****
Posts: 29


« 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?
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #1 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.

Best Regards,
Danijel Tkalcec
Logged
bebeantics
RTC License+
****
Posts: 29


« Reply #2 on: January 19, 2017, 08:01:36 PM »

Thank you

But I found nothing about rtcarray's.
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #3 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, which shows how to work with rtcRecords, rtcArrays and rtcDataSets - on Client and Server side.

Best Regards,
Danijel Tkalcec

Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.023 seconds with 16 queries.