sos!! Connecting custom functions to the report
i am so crazy!
i want to defind my own function,which will be included in fastreport. But i can't add my own function into the fastreport.How can i do?
the following is onuserfunction event of frxreport1;
function Tfrm_charge_unit.frxReport1UserFunction(const MethodName: String;
var Params: Variant): Variant;
begin
if MethodName = 'SmallToBig' then
Result := SmallToBig(Params[0]);
end;
the following is my own function in delphi
function Tfrm_charge_unit.SmallToBig(const n: Real): string;
i want to defind my own function,which will be included in fastreport. But i can't add my own function into the fastreport.How can i do?
the following is onuserfunction event of frxreport1;
function Tfrm_charge_unit.frxReport1UserFunction(const MethodName: String;
var Params: Variant): Variant;
begin
if MethodName = 'SmallToBig' then
Result := SmallToBig(Params[0]);
end;
the following is my own function in delphi
function Tfrm_charge_unit.SmallToBig(const n: Real): string;
Comments
frxReport1.AddFunction('function EMPTY(In : Variant) : Boolean', 'Cimsoft Report', 'Returns True If "In=0" or "In=''"');
Also try CompareStr or sth that does not compare case sensitiv. I had alwas UPPER(MethodName)=Upper('MyFuncName'). So all is working fine. I think MehtodName is always Upper.
Daniel
frxReport1.AddFunction('function EMPTY(In : Variant) : Boolean', 'Cimsoft Report', 'Returns True If "In=0" or "In=''"');
Could you tell me where i should put this code.
frxReport1.AddFunction('function Tfrm_charge_unit.SmallToBig(const n: Real): string');
Connecting custom functions to the report
this is a reference.
OnFormCreate.
and the rest in frxReport1UserFunction
Daniel.