Problem - Add Function

Hi ,
function Tfr_main.test: string;
begin
Result := 'Hi';
end;
function Tfr_main.re_one_dayUserFunction(const MethodName: string;
  var Params: Variant): Variant;
begin
if MethodName = 'test' then
Result := test ;
end;
frxReport2.AddFunction('Function test : String;', 'My functions', 'The MyFunc function always returns True');
frxReport2.OnUserFunction := frxReport2.OnUserFunction;

In the memo i wrote [test]

The Problem : When Run the Memo Text is Blank Not write the result of test .

same problem with function with param .

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 1:27AM
    In the memo i wrote [test]
    that would be how to display a variable named test
    you require a parameter for your function.
    [test(param)]
  • edited 1:27AM
    Thank you gordk

    No Param in function test .

    I test other function same this
    function Tfr_main.test(st : string) : string;
    begin
    Result := st;
    end;
    
    function Tfr_main.frxReport2UserFunction(const MethodName: string;
      var Params: Variant): Variant;
    begin
    if MethodName = 'test' then
    Result := test(Params[0]);
    end;
    
    frxReport2.AddFunction('function test(st : string) : string','my functio','testing');
    


    I wrote in memo [test('newtest')]

    Same problem.
  • edited 1:27AM
    I have solve the problem
    if AnsiCompareText(MethodName, 'test') = 0 then
    Result := test(Params[0]);
    

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.