Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy don't my functions appear in the FastReport function tab?
    primarykey
    data
    text
    <p>I am trying to implement some functions in an external unit and call them inside the FastReport script. My unit is properly compiled, but the problem is no function or procedure appears in the functions tab. Can anybody advise how to sort this out? I am not sure if I missed something.</p> <p>Below is an example of my unit code. The FastReport developer's guide states that the implementation should be like so.</p> <pre><code>unit frxCustomFuncs; interface var myGlobalVar: primitiveType; implementation uses sysUtils, Classes, fs_iinterpreter, myUnit; type TFunctions = class(TfsRTTIModule) private function CallMethod(Instance: TObject; ClassType: TClass; const MethodName: String; var Params: Variant): Variant; public constructor Create(AScript: TfsScript); override; end; procedure myCustomProcedure(myParam1, myParam2: TdateTime); var myVar: TMyCustomClass; //declared in myUnit begin myVar:= TMyCustomClass.create(myParam1, myParam2); try Some code ... myGlobalVar:= myVar.property; some code ... finally myVar.Free; end; end; { TFunctions } function TFunctions.CallMethod(Instance: TObject; ClassType: TClass; const MethodName: String; var Params: Variant): Variant; begin if MethodName = 'myCustomProcedure' then myCustomProcedure(Params[0], Params[1]); end; constructor TFunctions.Create(AScript: TfsScript); begin inherited create(AScript); with AScript do begin AddMethod('procedure myCustomProcedure(myParam1, myParam2: TdateTime)', CallMethod, 'My Functions', 'custom description'); end; end; initialization fsRTTIModules.Add(TFunctions); end. </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload