Running Multiple Reports

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 reports, this reports are 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.
Is it possible to run different reports separately selected from a list? Where am I making the mistake?
Than you very much

Best Answer

Answers

  • mohana_cse06mohana_cse06 Member Posts: 5,504
    I didn't understand why do you want to run separately.
    you can set filter in report request page in No. field like 1001..1010 or 1001|1003|1005 etc.
  • AitorEGAitorEG Member Posts: 342
    edited 2016-12-13
    May be I'm not explaining OK. I have a list view, where I can see a group of invoices. The issue is that, I want to select a group of invoices, 2 for example, and preview each invoice separately. Now, with the code I have wrote just above, I merge all the selected invoices in just one, taking just the header of the first customer. I hope I have explained myself better
    edit: If I select 2 invoices, the output is also 2 previews, but they are both the same. The headr of the first customer, and the movement of both invoices merged in 1 table.
  • lubostlubost Member Posts: 627
    1. Report 50014 is probably wrong, because grouping lines from multiple documents under one header is wrong.
    2. Variable PackHeader sent to report has filtered all records. You should use another record variable to filter exactly document from looping record.
  • AitorEGAitorEG Member Posts: 342
    lubost wrote: »
    1. Report 50014 is probably wrong, because grouping lines from multiple documents under one header is wrong.
    2. Variable PackHeader sent to report has filtered all records. You should use another record variable to filter exactly document from looping record.

    1-You are talking about what I've said about grouping lines from different customers, am I ok?
    2- Variable PackHeader has on it the records that have been selected from the list, and that seems to work fine, because I generate the same number of invoices as the number of invoices selected on the list.
  • lubostlubost Member Posts: 627
    1. I don't know anything about your report, but it seems to consist of header and lines. Printing lines "owned" by another header under current header is wrong.
    2. Report 50014 should print all headers in filtered range and this range is same in each loop - using record variable in RUN command sets filter, not exact record.
  • AitorEGAitorEG Member Posts: 342
    lubost wrote: »
    1. I don't know anything about your report, but it seems to consist of header and lines. Printing lines "owned" by another header under current header is wrong.
    2. Report 50014 should print all headers in filtered range and this range is same in each loop - using record variable in RUN command sets filter, not exact record.

    2-So you are saying that "PackHeader" is a range. I understand that, because it has all the ocurrences selected in the list, so it is a group of invoices. What should be the best way to take the headers one by one?
  • lubostlubost Member Posts: 627
    If report will works correctly, you shouldn't need a loop. SETSELECTIONFILTER should be enough to print documents in one report - new page per each document - see standard report 206
  • AitorEGAitorEG Member Posts: 342
    lubost wrote: »
    PackHeader.RESET;
    CurrPage.SETSELECTIONFILTER(PackHeader);
    IF PackHeader.FINDSET THEN REPEAT
    PackHeader2.reset;
    PackHeader2.setrange(filter producing single record based from PackHeader current record)
    REPORT.RUN(50014,TRUE,FALSE,PackHeader2);
    UNTIL PackHeader.NEXT = 0;

    where PackHeader2 has the same definition as PackHeader

    Thank you very much!!! It works perfectly with this:
    PackHeader2.SETRANGE("No.",PackHeader."No.");
    
    Thank you again, as I said before, I have only spent working with NAV a few days, and really apreciate your help, and also thanks to @mohana_cse06 !!
Sign In or Register to comment.