RAP in design mode
Hi,
I need some help. I have done what I think is everything to get self defined
functions to work in the design mode of the ReportBuilder.
The following is my code:
In additiion I've created a package with this code with the designtime only
option. It compiles and installs. The functions show up under the Language
Tab, but when I drag and drop either of the functions into the event coder,
the function name and parameters do move into the event area, but when I
compile the event, it says "Undeclared Identifier; FltDivByZero".
***************************************************************
unit AulRapFunctions;
interface
uses Forms, raFunc, ppRTTI, sysutils;
type
TMyAulFunctions = class (TraSystemFunction)
public
class function Category: String; override;
end;
TIntDivByZeroFunction = class (TMyAulFunctions)
public
class function GetSignature : string; override;
procedure ExecuteFunction(aParams: TraParamList); override;
end;
TFltDivByZeroFunction = class (TMyAulFunctions)
public
class function GetSignature : string; override;
procedure ExecuteFunction(aParams: TraParamList); override;
end;
implementation
class function TMyAulFunctions.Category: String;
begin
result := 'AulRAPFunctions';
end;
class function TIntDivByZeroFunction.GetSignature : string;
begin
result := 'function IntDivByZero(X, Y: integer): single;';
end;
class function TFltDivByZeroFunction.GetSignature : String;
begin
result := 'function FltDivByZero(X, Y: single): single;';
end;
procedure TIntDivByZeroFunction.ExecuteFunction(aParams: TraParamList);
var
lx : integer;
ly : integer;
lresult : single;
begin
getparamvalue(0,lx);
getparamvalue(1,ly);
try
lresult := lx/ly;
except
on exception do lresult := 0;
end;
SetParamValue(2,lresult);
end;
procedure TFltDivByZeroFunction.ExecuteFunction(aParams: TraParamList);
var
lx : integer;
ly : integer;
lresult : single;
begin
getparamvalue(0,lx);
getparamvalue(1,ly);
try
lresult := lx/ly;
except
on exception do lresult := 0;
end;
SetParamValue(2,lresult);
end;
initialization
raRegisterFunction('function IntDivByZero', TIntDivByZeroFunction);
raRegisterFunction('function FltDivByZero', TFltDivByZeroFunction);
finalization
raUnRegisterFunction('function IntDivByZero');
raUnRegisterFunction('function FltDivByZero');
end.
I need some help. I have done what I think is everything to get self defined
functions to work in the design mode of the ReportBuilder.
The following is my code:
In additiion I've created a package with this code with the designtime only
option. It compiles and installs. The functions show up under the Language
Tab, but when I drag and drop either of the functions into the event coder,
the function name and parameters do move into the event area, but when I
compile the event, it says "Undeclared Identifier; FltDivByZero".
***************************************************************
unit AulRapFunctions;
interface
uses Forms, raFunc, ppRTTI, sysutils;
type
TMyAulFunctions = class (TraSystemFunction)
public
class function Category: String; override;
end;
TIntDivByZeroFunction = class (TMyAulFunctions)
public
class function GetSignature : string; override;
procedure ExecuteFunction(aParams: TraParamList); override;
end;
TFltDivByZeroFunction = class (TMyAulFunctions)
public
class function GetSignature : string; override;
procedure ExecuteFunction(aParams: TraParamList); override;
end;
implementation
class function TMyAulFunctions.Category: String;
begin
result := 'AulRAPFunctions';
end;
class function TIntDivByZeroFunction.GetSignature : string;
begin
result := 'function IntDivByZero(X, Y: integer): single;';
end;
class function TFltDivByZeroFunction.GetSignature : String;
begin
result := 'function FltDivByZero(X, Y: single): single;';
end;
procedure TIntDivByZeroFunction.ExecuteFunction(aParams: TraParamList);
var
lx : integer;
ly : integer;
lresult : single;
begin
getparamvalue(0,lx);
getparamvalue(1,ly);
try
lresult := lx/ly;
except
on exception do lresult := 0;
end;
SetParamValue(2,lresult);
end;
procedure TFltDivByZeroFunction.ExecuteFunction(aParams: TraParamList);
var
lx : integer;
ly : integer;
lresult : single;
begin
getparamvalue(0,lx);
getparamvalue(1,ly);
try
lresult := lx/ly;
except
on exception do lresult := 0;
end;
SetParamValue(2,lresult);
end;
initialization
raRegisterFunction('function IntDivByZero', TIntDivByZeroFunction);
raRegisterFunction('function FltDivByZero', TFltDivByZeroFunction);
finalization
raUnRegisterFunction('function IntDivByZero');
raUnRegisterFunction('function FltDivByZero');
end.
This discussion has been closed.
Comments
first parameter. This is incorrect, include only the name of the function:
raRegisterFunction('FltDivByZero', TFltDivByZeroFunction);
instead of
raRegisterFunction('function FltDivByZero', TFltDivByZeroFunction);
make sure you make the same correction to the raUnregisterFunction calls.
--
--
Robert Leahey
TRX Technology Services
Huh? I thought you were with DM?
Oliver
I was...
--
Robert Leahey
TRX Technology Services