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;

Comments

  • dschuchdschuch Dresden,Germany
    edited 7:54PM
    I'm not sure, but in earlier time you had to (and I do it actually in the same way)

    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
  • thanks very much!!!

    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.
  • maybe i also can add the following code in my procedure. But i also want to ask where i can add this code. i except your help! so thanks.

    frxReport1.AddFunction('function Tfrm_charge_unit.SmallToBig(const n: Real): string');
  • http://www.fast-report.com/en/documentatio...he%20report.htm
    Connecting custom functions to the report

    this is a reference.
  • dschuch . could you help me ? ;)
  • dschuchdschuch Dresden,Germany
    edited 7:54PM
    I do it in

    OnFormCreate.

    and the rest in frxReport1UserFunction

    Daniel.

Leave a Comment