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 9:21AM
    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 9:21AM
    I do it in

    OnFormCreate.

    and the rest in frxReport1UserFunction

    Daniel.

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.