Scripting error
Using FastReport VCL v5.1.5 and Delphi XE6:
I have an exisiting report FastReport that previews successfully.
When I add the code below to the beginning of the report's Code tab I get a "';' expected" error when previewing the report in the designer and my Delphi application (<NumPrinted> is a Report variable).
If I comment out the first line only I still get the "';' expected" error. (I can't see a missing [img]style_emoticons/<#EMO_DIR#>/wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" /> If I comment out the second line only I get an "Undeclared identifier: 'frxReport'" error. (The procedure name[/img]is frxReport..... )
How do I correct the code ?
My intention is to send back to my Delphi application the number of copies actually printed from the report preview window.
I have an exisiting report FastReport that previews successfully.
When I add the code below to the beginning of the report's Code tab I get a "';' expected" error when previewing the report in the designer and my Delphi application (<NumPrinted> is a Report variable).
If I comment out both lines of code in the procedure I get no error;Var
NewCopies : integer;
procedure frxReportOnReportPrint(Sender: TfrxComponent);
begin
NewCopies := frxReport.PrintOptions.Copies;
<NumPrinted> := <NumPrinted> + NewCopies;
end;
If I comment out the first line only I still get the "';' expected" error. (I can't see a missing [img]style_emoticons/<#EMO_DIR#>/wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" /> If I comment out the second line only I get an "Undeclared identifier: 'frxReport'" error. (The procedure name[/img]is frxReport..... )
How do I correct the code ?
My intention is to send back to my Delphi application the number of copies actually printed from the report preview window.
Comments
what kind of variable is "<NumPrinted>"? i.e. system, report, external, if it's a report variable, probably you should initialize the value of variable, zero for example, maybe the current value of your variable is null, in that case, when you preview the report generate that kind of error
regards
It's rather counter-intuitive though : the FR-Object Inspector contains 'frxReport: TfrxReport' and all the procedures are named 'frxReport...' - so why do you have to use 'Report.PrintOptions..' instead of 'frxReport.PrintOptions.. ?
It's also not obvious that you have to use
'Report.EngineOptions.DestroyForms := False;'
to be able to read back the changed report variable <NumPrinted> after preview and printing.
Many thanks.