copy loop

I copied this code from another report for the copy loop. But I don’t understand why its not working. it only prints one page and the other page is just the header with out any information. I have been going crazy trying to figure this out, any help will be appreciated.

I created a data item of integer and in that trigger i put this code.

NoCopies:=3;
NoLoops := 1 + ABS(NoCopies);
IF NoLoops <= 0 THEN
NoLoops := 1;
CopyNo := 0;

CopyLoop - OnAfterGetRecord()
CurrReport.PAGENO := 1;
IF CopyNo = NoLoops THEN BEGIN
IF NOT CurrReport.PREVIEW THEN
PurchasePrinted.RUN(“Purchase Header”); /////// what is this line doing?
CurrReport.BREAK;
END ELSE
CopyNo := CopyNo + 1;
IF CopyNo = 1 THEN // Original
CLEAR(CopyTxt)
ELSE
CopyTxt := Text000;

Check Filters on PreDataItem PurchasePrinted.RUN - Will increment number of printed pages information in document header.

Since mine is a custom report, i don’t know what should replace this particular line.

PurchasePrinted.RUN(“Purchase Header”); /////// what is this line doing?

Depends if you want to increment number of printed reports field in your document.

Does that mean i can print 3 copies by incrementing that? if so, how do i do that?

Here are my data items:

DataItem Name
Sales Header
Package
Package Line
Integer CopyLoop

No,

If you look at Posted Sales invoice, you will see a field Nº of Printed. Every time you print a report that number will be incremented.

If look at codeunit it’s just simple has this.

FIND;
“No. Printed” := “No. Printed” + 1;
MODIFY;
COMMIT;