Loading a foundset from arguments

Hello,
I am tring to load a foundset onto a different form with the “use different found set on”, I know it may be a simple one but I am getting confused. I have no problem using the following code to load a single record.

var vRecordId = arguments[0] // will receive the recordId that your button method passed
controller.find();
productsid = vRecordId // search for the ID that was passed
controller.search()
//Show this form in print preview
controller.showPrintPreview();

fired off with

forms.stocktake_count_report.gotoDetails(productsid);

But if it is a group of records to be displayed in list view, how would I acheive this??

As always, many thanks in advance

There is two possibilities:

  1. The “group of records” is the foundset in a form A and you want to pass that foundset to another form B:

forms.stocktake_count_report.controller.loadRecords(foundset)

where “stocktake_count_report” is form a B and the foundset is the one from form B. This will load the foundset from form B in form A.

  1. You want to pass single record(ids) from form A to form B. The easiest is to create an array of primary keys of the records in form A and pass that array to the method in form B. In your method in form B you can then search for all PKs in the array.

Hope this helps.