Uses
SysUtils, raFunc, ppRTTI, Math;
type
TmyRoundToFunction =
class(TraSystemFunction)
public
class function Category:
string;
override;
procedure ExecuteFunction(AParams: TraParamList);
override;
class function GetSignature:
string;
override;
end;
implementation
class function TmyRoundToFunction.Category:
string;
begin
Result := '
Crystal Reports';
end;
procedure TmyRoundToFunction.ExecuteFunction(AParams: TraParamList);
var
AValue: Extended;
AResult: Extended;
ATempDigit: Integer;
ADigit: TRoundToEXRangeExtended;
// [-20 .. 20]
begin
GetParamValue(0, AValue);
GetParamValue(1, ATempDigit);
try
ADigit := ATempDigit;
// prüfen auf TRoundToEXRangeExtended
AResult := RoundTo(AValue, ADigit);
SetParamValue(2, AResult);
except
raise Exception.Create('
ADigit ist kein TRoundToEXRangeExtended');
end;
end;
class function TmyRoundToFunction.GetSignature:
string;
begin
Result := '
function RoundTo(const AValue: Extended; const ADigit: Integer): Extended';
end;
initialization
raRegisterFunction('
RoundTo', TmyRoundToFunction);
finalization
raUnRegisterFunction('
RoundTo');
end.