Set number of copies in a FORNAV report
FORNAV has a great tool for setting the number of copies in a report. Instead of adding a CopyLoop data item, you can simply set the number of copies with a function call.
There are a few steps to add this code. First, you need to create a global variable to hold the number of copies:
trigger OnPreReport()beginReportForNav.SetCopies('Header', NoOfCopies);ReportForNav.LoadWatermarkFromSetup(ForNav_WatermarkType::Document);end;varNoOfCopies: Integer;
Next, you set the No. of Copies on the report request page:
requestpage{SaveValues = true;layout{area(content){group(Options){Caption = 'Options';field(NoOfCopies; NoOfCopies){ApplicationArea = All;Caption = 'No. of Copies';}}}}}
Finally, you set the number of copies in the OnPreReport trigger for the Universal Code version of FORNAV reports:
trigger OnPreReport()beginReportForNav.SetCopies('Header', NoOfCopies);end;
And the version for the DLL based reports:
trigger OnPreReport()beginReportForNav.GetDataItem('Header').Copies := NoOfCopies;ReportsForNavPre;end;