Home General

RAP in design mode

edited July 2001 in General
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.

Comments

  • edited July 2001
    Your calls to raRegisterFunction are including the word 'function' in the
    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
  • edited July 2001
    > Robert Leahey

    Huh? I thought you were with DM?

    Oliver
  • edited July 2001
    > Huh? I thought you were with DM?

    I was...

    --
    Robert Leahey
    TRX Technology Services
This discussion has been closed.