If you want to print more than one document in a document list at one stroke – e.g. sales invoices – you would select 2 or more records and then start printing.
But, … in the request page only the last selected document no. or, also possible, no number is set.
Internally in most cases a setselectionfilter command is applied to get the selected records. But whats going on, when selecting the records? each record is marked. With setselectionfilter we can filter the selected record for the setfilter expression.
To print all selected records in one stroke you can do following. Add a new action to the action list of the list page and add following code to the new action trigger:
// local variables SalesInvHeader | Record | Sales Invoice Header noFilter | Text // the code - OnAction() CurrPage.SETSELECTIONFILTER(SalesInvHeader); // fetch the marks // internally property Marked is set to true at the selected records // the loop will fetch only these records IF SalesInvHeader.FINDFIRST THEN BEGIN REPEAT IF noFilter '' THEN noFilter := noFilter + '|'; noFilter := noFilter + SalesInvHeader."No."; // create filter expr. UNTIL SalesInvHeader.NEXT = 0; CLEAR(SalesInvHeader); SalesInvHeader.SETFILTER("No.",noFilter); // create the filter END; REPORT.RUNMODAL(206,TRUE,FALSE,SalesInvHeader);
As result we get: