The following example uses the ListView_SelectionCount() function to retrieve the number of items selected in the Explorer List list view field. The ListView_SelectionGet() function retrieves each item in the selection. Then the Buyers report is printed based on the item.
local long selection_count, item_index, i; local string item_ID; {Retrieve the number of items selected.} selection_count = ListView_SelectionCount('Explorer List'); if selection_count > 0 then {Print the selected items.} for i = 1 to selection_count do {Get the index of the next selected node.} item_index = ListView_SelectionGet('Explorer List', i); item_ID = ListView_ItemGetSubitem('Explorer List', item_index, 1); {Print the report.} run report 'Buyer Report' with restriction 'Buyer ID' of table Buyer_Data = item_ID destination true, false; end for; else {No items selected to print.} warning "No item selected to print."; end if;