There is another picking method available: you can pick multiple items at once.
The option to select multiple items is enabled by default in all list forms. But the option to pick the selected items is usually disabled.
To enable the option, let us use the MultipleChoice parameter of the dynamic list form extension.
- In the GoodsReceipt document form, update the Pick command handler as shown in listing 26.4.
Listing 26.4. Pick button click handler
&AtClient Procedure Pick(Command) FormParameters = New Structure ("MultipleChoice", True); OpenForm("Catalog.MaterialsAndServices.ChoiceForm", FormParameters, Items.Materials); EndProcedure
In the multiple selection mode the form returns an array of items instead of a single item. So you have to iterate through the array in the ChoiceProcessing handler. - Update the ChoiceProcessing event handler as shown in listing 26.5.
Listing 26.5. ChoiceProcessing event handler for the Materials table
&AtClient Procedure MaterialsChoiceProcessing(Item, SelectedValue, StandardProcessing) For Each SelectedItem In SelectedValue Do NewRow = Object.Materials.Add(); NewRow.Material = SelectedItem; EndDo; EndProcedure