How to pass the active field on a form to a report

This question is answered

Our receiving team in the warehouse wants to print a simple part label when they are receiving items. I would like to add a button on the form Accounts Payable > Common > Purchase Orders > All Purchase Orders in the Generate group of the Receive Tab. When pressed, this button would print out a simple label report, printing one label for every line item on the selected purchase order in the form grid. I don't know how to pass the active grid selection of the form as a filter for the report. Simple examples would be greatly appreciated!

Verified Answer
  • Simple code for passing a record as an arg to a report. Same as passing a record to a form

           Args                args = new Args();

           ;    

           args.name(reportStr(<reportname>));

           rr = classFactory.reportRunClass(args);

           args.record(<your table>);

           //Run report

           rr.init();

           rr.run();

    Angel

All Replies
  • Hi Jared,

    Firstly, you can gather the records selected in the grid by using MultiSelectionHelper class. You can find an example of it in the SalesCancelOrderDropDialog form (closeOk method).

    Then, you will pass the selected records to a report. One way is to pass the selected recId's as a comma separated string to the RDP class and do the filtering there.

    Kind regards,

    Dominic

    My blog | PBC

    This forum post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.

  • Simple code for passing a record as an arg to a report. Same as passing a record to a form

           Args                args = new Args();

           ;    

           args.name(reportStr(<reportname>));

           rr = classFactory.reportRunClass(args);

           args.record(<your table>);

           //Run report

           rr.init();

           rr.run();

    Angel