RTC Forums
November 24, 2024, 03:12:52 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Login Register  
Pages: [1]
  Print  
Author Topic: How to return more than one value in TRtcFunction  (Read 5309 times)
sfarmer
RTC Expired
*
Posts: 9


« on: February 05, 2014, 09:50:43 PM »

Hi,

We are trying to replace DataSnap with RealThinClient. We have created a Client and Server app with TRtcFunctions. In one of the functions I need to return a Stream and a set of parameters that define information about the stream such as Type, etc. How can I return the stream and additional return value(s)?

Thanks

Simon
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #1 on: February 05, 2014, 09:54:15 PM »

Check this FAQ Topic.

For more information, please go through these topics.

Best Regards,
Danijel Tkalcec
Logged
sfarmer
RTC Expired
*
Posts: 9


« Reply #2 on: February 06, 2014, 07:02:59 AM »

Hi,

I got this working in 2 ways:-

  with Result.NewRecord() do
  begin
    asInteger['Type'] := 1234;
    NewByteStream('Stream').WriteBuffer(MemoryStream.Memory^,MemoryStream.Size);
  end;

and

  with (Result.NewArray()) do
  begin
    asInteger[0] := 1234;
    NewByteStream(1).WriteBuffer(MemoryStream.Memory^,MemoryStream.Size);
  end;

I was wondering is there any benefit to using an Array or Record?

Thanks

Simon
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #3 on: February 06, 2014, 09:15:10 AM »

Records have fields with names, Arrays have fields with integer values and start at index 0. You will use one or the other based on your requirements.

Best Regards,
Danijel Tkalcec
Logged
sfarmer
RTC Expired
*
Posts: 9


« Reply #4 on: February 06, 2014, 12:24:17 PM »

Hi,

I'm using TRtcHTTPClient in blocking mode with the following function:-

  procedure TdmClient.GetSpecialData(var Data: string);
  begin
    with ClientModule do
    begin
      with Data.newFunction('GetSpecialData') do
      begin
        Call(GetSpecialDataResult);

        // Can I get at the Result here so that I can set Data?
      end;
    end;
  end;

Is it possible to get at the result after the Call(GetSpecialDataResult) as I want to be able to return the Data value?

I know I can store the result with a TRtcResult but i'm going to have lots of these calls and it makes it a little messy.

Thanks

Simon
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #5 on: February 06, 2014, 12:41:33 PM »

You are asking questions which are all answered in the FAQ topic I've posted above. Please read it through and you will find all your answers. You can not start using the components, without having at least the basic understanding of how they work.

Before you dive into your Project and start asking questions on the Forums, please take a few days to go through Quick Start lessons and examples.

Thank you.

Best Regards,
Danijel Tkalcec
Logged
sfarmer
RTC Expired
*
Posts: 9


« Reply #6 on: February 06, 2014, 02:09:11 PM »

Hi,

Yes you are right, sorry about that. I have everything working now.

Thanks

Simon
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.026 seconds with 17 queries.