RTC Forums
November 24, 2024, 02:39:26 PM
Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Home
Help
Login
Register
RTC Forums
>
Subscription
>
Support
>
How to return more than one value in TRtcFunction
Pages: [
1
]
« previous
next »
Print
Author
Topic: How to return more than one value in TRtcFunction (Read 5302 times)
sfarmer
RTC Expired
Posts: 9
How to return more than one value in TRtcFunction
«
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
Re: How to return more than one value in TRtcFunction
«
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
Re: How to return more than one value in TRtcFunction
«
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
Re: How to return more than one value in TRtcFunction
«
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
Re: How to return more than one value in TRtcFunction
«
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
Re: How to return more than one value in TRtcFunction
«
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
Re: How to return more than one value in TRtcFunction
«
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
« previous
next »
Jump to:
Please select a destination:
-----------------------------
Dashboard
-----------------------------
=> General
=> 3rd-Party
=> Quick Start
-----------------------------
Subscription
-----------------------------
=> Support
Loading...