access functions from other units

How to get access functions from other project units in the code tab from fastreport.

I create a test program with 2 units (unit1, unit2) and copy the example code from the manual to the fr designer code tab.


#language PascalScript

program MyProgram;

// the “uses” chapter should be located before any other chapter

uses 'unit1.pas', 'unit2.pas';

var // the “variables” chapter can be placed anywhere

i, j: Integer;

const // “constants” chapter

pi = 3.14159;

procedure p1; // procedures and functions

var

i: Integer;

procedure p2; // nested procedure

begin

end;

begin

end;

  

begin // main procedure.

 ShowMessage('Hallo');                         

end.


When I run my proc and call frxReport1.ShowReport(), I get this error message (can't find unit2.pas):

Sure, unit1 & 2.pas are under S:\__test but how to tell the designer the correct path?

And when I run the script in the designer I get this error message: (BEGIN expected)


Comments

  • gpigpi Volnovakha, Ukraine

    Try to comment first two lines of the script

  • Thank you. unfortunately same error.

  • gpigpi Volnovakha, Ukraine

    Copy Unit2.pas into S:\__test\Win32\Debug folder

  • Thanks, but the Debug Folder ist for dcu-Files not for pas-Files.

    I can write the complete path in the script (same as copy pas files to Debug folder)

    Running the script:


    Running from the test program:


  • gpigpi Volnovakha, Ukraine

    Is unit1.pas FS unit? FR will not works with Delphi's units. Use Fast Script unit

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.