Hello.
I have created an UserFunction and I assigned it to the OnUserFunction Event:
procedure TfrmRepProduccionHilanderia.frReport1UserFunction(const AName: String; p1, p2, p3: Variant; var Val: Variant);
var
cPorcent: real;
begin
if AName = 'MYFUNCTION' then
begin
cPorcent := frParser.Calc(P1);
Val := FormatFloat('0.00',cPorcent)+'%';
end;
end;
This is a simple function to ilustrate my problem.
In the report I invoke this functiojn in a memo object in this way:
[MYFUNCTION(dbQuery."cPorcent")]
In this case it works OK: on cPorcent = 5.7, I get "5.70%", no problem there.
The problem is in a GroupFooter band, where I need to invoke my function like this:
[MYFUNCTION(SUM(dbQuery."cPorcent",MasterData1))]
in this case, using a SUM() function as parameter, frParser.Calc(P1) always returns 0.
Why is that? The user defined function only accept db fields? I hope not !
Tks !