#1 2016-07-10 07:07:53

Peter Evans
Member
Registered: 2016-07-03
Posts: 32

Two problems I am having generating client wrappers

1)
The following is an extract from generated mORMotClient.
(I have stripped out some unnecessary parameters from the extract.)
The object TMemSettingObj is one I have devised.

Against this line :-

  MemSettingObj := TableMemSettingObj.TMemSettingObj.CreateFromVariant(res[7]);

I get an error :-

  'TMemSettingObj' does not contain a member named 'CreateFromVariant'.

  /// implements ILoginAdmin from http://localhost:888/root/LoginAdmin
  // - this service will run in sicShared mode
  TServiceLoginAdmin = class(TServiceClientAbstract,ILoginAdmin)
  public
    constructor Create(aClient: TSQLRestClientURI); override;
    function LoginAdmin(const Company1: String; ... var ServerTime: TDateTime; var MemSettingObj: TableMemSettingObj.TMemSettingObj): Boolean;
  end;

function TServiceLoginAdmin.LoginAdmin(const Company1: String; ... var ServerTime: TDateTime; var MemSettingObj: TableMemSettingObj.TMemSettingObj): Boolean;

var res: TVariantDynArray;
begin
  fClient.CallRemoteService(self,'LoginAdmin',9, // raise EServiceException on error
    [Company1, ... DateTimeToIso8601(ServerTime),ObjectToVariant(MemSettingObj)],res);
  LoginInfoInt := res[0];
  ...
  ServerTime := Iso8601ToDateTime(res[6]);
  MemSettingObj.Free; // avoid memory leak
  MemSettingObj := TableMemSettingObj.TMemSettingObj.CreateFromVariant(res[7]);
  Result := res[8];
end;

What do you suggest I need to do to fix this problem?


2)
The object TMemActiveObj is one I have devised.

Against this line :-

  [Company1,Name1,Token1,ObjectToVariant(MemActiveObj),iLastAutoInc],res);

I get an error :-

  Incompatible types: 'TSQlRecord' and 'TMemActiveObj'.

/// implements ILogoffAdmin from http://localhost:888/root/LogoffAdmin
  // - this service will run in sicShared mode
  TServiceLogoffAdmin = class(TServiceClientAbstract,ILogoffAdmin)
  public
    constructor Create(aClient: TSQLRestClientURI); override;
    function LogoffAdmin(const Company1: String; const Name1: String; const Token1: Integer; const MemActiveObj: TableMemActiveObj.TMemActiveObj; var iLastAutoInc: Integer): Boolean;
  end;


function TServiceLogoffAdmin.LogoffAdmin(const Company1: String; const Name1: String; const Token1: Integer; const MemActiveObj: TableMemActiveObj.TMemActiveObj; var iLastAutoInc: Integer): Boolean;
var res: TVariantDynArray;
begin
  fClient.CallRemoteService(self,'LogoffAdmin',2, // raise EServiceException on error
    [Company1,Name1,Token1,ObjectToVariant(MemActiveObj),iLastAutoInc],res);
  iLastAutoInc := res[0];
  Result := res[1];
end;

What do you suggest I need to do to fix this problem?

Regards,
  Peter Evans

Offline

#2 2016-07-10 11:40:59

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,240
Website

Re: Two problems I am having generating client wrappers

How is you TMemSettingObj defined and registered?

We need more code to reproduce your problem.
Please do not post code in the forum, but use a separated link.
See point 7 of http://synopse.info/forum/misc.php?action=rules

Offline

#3 2016-07-10 12:08:22

Peter Evans
Member
Registered: 2016-07-03
Posts: 32

Re: Two problems I am having generating client wrappers

Thanks for that reply. I will look further into your question.

Offline

Board footer

Powered by FluxBB