rodolfo
(Rodolfo)
1
IDE: Delphi XE6
Version 9.2.103.1311 Server Edition
Hi,
I need to call a function in a Business Rules I found this code but is not working I got this error:
procedure RegAudit(args: array of variant);
procedure TSRG_DataService.RegAudit(args: array of variant);
begin
//
end;
procedure TSRG_DataService.DataAbstractServiceActivate(const aClientID: TGUID;
aSession: TROSession; const aMessage: IROMessage);
begin
EcmaScriptProvider.Engine.Variables.SetVariable(‘RegAudit’, RegAudit);
end;
Error:
[dcc32 Error] SRG_DataService_Impl.pas(75): E2250 There is no overloaded version of ‘SetVariable’ that can be called with these arguments
what is wrong ?
Regards!
EvgenyK
(Evgeny Karpov)
3
you have declared RegAudit
incorrectly.
TDAEcmaFunction = function (args: array of variant): variant of object;
procedure SetVariable(aName: string; aFunc: TDAEcmaFunction);overload;
so your RegAudit
should be
procedure TSRG_DataService.RegAudit(args: array of variant): variant;
Note. in some versions of Delphi, direct assignment may not work, so you need to use code like
procedure TSRG_DataService.DataAbstractServiceActivate(const aClientID: TGUID;
aSession: TROSession; const aMessage: IROMessage);
var
f: TDAEcmaFunction;
begin
f := RegAudit;
EcmaScriptProvider.Engine.Variables.SetVariable(‘RegAudit’, f);
end;