I still have trouble with Custom Functions

Sorry to return to this question, but I do not see what I'm doing wrong.

I followed the Developer manual, pages 43-45:

1- "If you wish to connect (add) a large number of functions, it is recommended to placet all logic in a separate library unit. Here is an example:"
unit FastReportFunctions;

interface

implementation

uses SysUtils, Classes, fs_iinterpreter;

type
 TFastReportFunction = class(TfsRTTIModule)
private
  function CallMethod(Instance: TObject; ClassType: TClass; const MethodName: String; var Params: Variant): Variant;
public
  constructor Create(AScript: TfsScript); override;
end;


function FRFileExist(aFile: String): Boolean;
begin
  if (FileExists(aFile)) then
    Result:= True
  else
    Result:= False;
end;

{ TFastReportFunction }

constructor TFastReportFunction.Create;
begin
  inherited Create(AScript);
  AScript.AddMethod('function FRFileExist(aFile: String): Boolean;', CallMethod, 'My functions', ' Verifica se existe o arquivo');
end;


function TFastReportFunction.CallMethod(Instance: TObject; ClassType: TClass; const MethodName: String; var Params: Variant): Variant;
begin
if MethodName = 'FRFILEEXIST' then
   Result := FRFileExist(Params[0]);
end;

initialization
 fsRTTIModules.Add(TFastReportFunction);
end.

2 -" Save the file with a .pas extension then add a reference to it in the uses clause of
your Delphi project???s form and all your custom functions will be available for use in any
report component. No need to write code to add these functions to each ???TfrxReport???, and
no need to write additional code for each report component???s ???onuserfunction ??? handler."


This simply does not happen!!!

When I open any report, the custom function does not appear in the function tree.

My reports are in a Data Module.

My Delphi version is XE2 e FR version is 4.12.

Thanks and sorry for my English.

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 2:43AM
    they will be available for use but will not display in the function tab.
  • gpigpi
    edited 2:43AM
    See a sample in attach
  • Thanks gordk and gpi.

    I managed to solve with your help, and want to share with everyone:

    I added a new project and created a Package.

    In the package insert unit with the custom functions of Fast Report.

    Next compile and install the package.

    The function appears in Fast Report.

    But I do not know why, she's doubled.
    FR.png 244.7K

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.