Convert SETSELECTIONFILTER to SETFILTER
Views (13307)
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 <Action1100022000> - 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:
Cheers
Filed under: c/al, nav 2009, nav 2013, nav functions Tagged: c/al, filter, nav 2009, nav 2013, print

Comments
-
Introduction: I have been working in NAV/BC for a couple of years to master the craft and to some extent all of us are successful. But a single scenario/ user error/misunderstanding can create a big question mark. This blog is mainly divided into two
-
Introduction: I have been working in NAV/BC for a couple of years to master the craft and to some extent all of us are successful. But a single scenario/ user error/misunderstanding can create a big question...
*This post is locked for comments