Running Multiple instances of the same Report

Hi everyone!
This is my first time I make a question here. I am new working with NAV, so I hope I don’t ask any stupid issue…
I am trying to run different invoices for diferent clients. I don’t have any problem to run the report from the page of one specific invoice, but the problem comes when I want to run more than one report a time.
I have a page, with the list of the different invoices to run. My idea is to select different invoices from that list, and run each invoice separately. My code for this action is:

PackHeader.RESET;
CurrPage.SETSELECTIONFILTER(PackHeader);
IF PackHeader.FINDSET THEN REPEAT
  REPORT.RUN(50014,TRUE,FALSE,PackHeader);
UNTIL PackHeader.NEXT = 0;

With this code, the output is just one invoice, with the header of the first customer, and a table with the movement of all the selected invoices, but merged in just one invoice. If I select 2 invoices, the output is also 2 previews, but they are both the same. The header of the first customer, and the movement of both invoices merged in 1 table.

What can I do to generate the invoices separetely?

Thank you very much!

You have to check if the Grouping is done correctly in your report.

You can refer standard reports like Sales-Invoice (Report 206) to check how printing of multiple invoice is done.

Hi Aitor,

Whenever you run the report, then it runs it for each of the packheaders in the filter.
You need to filter the record you use to run the report, so that it only selects the one in your findset loop.

Thank you both! I’ve solved the problem with this code:

PackHeader.RESET;
CurrPage.SETSELECTIONFILTER(PackHeader);
IF PackHeader.FINDSET THEN REPEAT
**PackHeader2.reset;**
**PackHeader2.setrange(**"No.",PackHeader."No."**)**
REPORT.RUN(50014,TRUE,FALSE,PackHeader**2**);
UNTIL PackHeader.NEXT = 0;

Thank you again!!