RTC Forums

Subscription => Support => Topic started by: dpcroghan on December 24, 2013, 06:46:42 PM



Title: Records as remote function input parameters
Post by: dpcroghan on December 24, 2013, 06:46:42 PM
Hi Danijel,

I'd like to pass a record as an input parameter to a remote function, containing three strings: a file name, the directory name, and a security ID (hash code). How would I do this? Would I use the NewRecord method?

Thanks for your help!

Code:
// This works fine, but I'd like to include two more strings as input       
RtcClientModule1.Data.NewFunction('DeleteFile').asString['FilePath'] :=
          rdsClient.Request.Query['file'];

// How do initialize a record?
//RtcClientModule1.Data.NewFunction('DeleteFile').NewRecord()


Title: Re: Records as remote function input parameters
Post by: D.Tkalcec (RTC) on December 24, 2013, 07:41:29 PM
Did you see this Quick Start topic (https://rtcforum.teppi.net/index.php?topic=311.0)?

You can pass any structure you want as parameters to a remote function call and also receive any structure as a result. You can also pass multiple parameters without creating a separate record. It all depends on what you want or need.


RtcClientModule.Prepare('DeleteFile');

// FilePath := ...
RtcClientModule.Param.asString['FilePath']:= 'c:/filename.txt' ;
// FileSize := ...
RtcClientModule.Param.asInteger['FileSize']:= 12345;
// FileDate := ...
RtcClientModule.Param.asDateTime['FileDate']:= Now;

// Make a UserInfo record ...
RtcClientModule.Param.newRecord('UserInfo');
// UserInfo.FirstName := ...
RtcClientModule.Param.asRecord['UserInfo'].asString['FirstName']:= 'Peter' ;
// UserInfo.LastName := ...
RtcClientModule.Param.asRecord['UserInfo'].asString['LastName']:= 'Pan' ;

Best Regards,
Danijel Tkalcec


Title: Re: Records as remote function input parameters
Post by: dpcroghan on December 24, 2013, 08:45:12 PM
I had not seen that link before, lots of good information that I will read. All I had found was Lesson 5. Thanks for the examples too.

Merry Christmas!