Performing actions for marked rows

The action chosen needs to be performed for every row that is marked in the list. How the marked rows are accessed depends on the type of action being performed.

Multi-select actions

When a multi-select action is being performed, you must retrieve a reference to the temporary table that contains the marked rows. The GetMarkedRecordsTableRef() function of the syListObj form retrieves the reference to this table. The GetMarkedRecordsTableIndex() function of the syListObj form retrieves the index number to use when accessing the records. You will use this table reference to retrieve specific information about the current marked rows that are being processed. The following example shows the basic looping code used to process the marked rows.

local reference ListTableReference;
local integer ListTableIndex;

ListTableReference = GetMarkedRecordsTableRef(list_object) of form syListObj;
ListTableIndex = GetMarkedRecordsTableIndex(list_object) of form syListObj;

{Get the first row that is marked}
get first table(ListTableReference) by number ListTableIndex;

while err() = OKAY do

	{Perform the action on the current row}

	{Get the next row that is marked}
	get next table(ListTableReference) by number ListNumberIndex;
end while;

For a multiselect action, you must call the List_MultiSelectActionCompleteEvent procedure to indicate that the action has been completed for all of the marked items. A complete example of performing an action for the marked rows is show in Logging action status.

Single-select actions

When a single-select action is being performed, you must use the 'Table Reference' component of the list object composite to find out the row that is marked. The action will be performed for this row. The following example shows a portion of the ExecuteAction procedure for the Leads list. This code runs in response to the Edit Lead action. This action is a single-select action that opens the maintenance window for the row that is marked in the list.

open form IG_Lead_Maintenance;
'Lead ID' of window 'Lead Maintenance' of form IG_Lead_Maintenance =  'Lead ID' of table (list_object:'Table Reference');
run script 'Lead ID' of window 'Lead Maintenance' of form IG_Lead_Maintenance;

Always-available actions

When an always-available action is being performed, the marked row information available will depend on the number of rows marked in the list. If no rows are marked, no record information is available. If one row is marked, the 'Table Reference' component of the list object composite will contain the marked row. If more than one row is marked, the 'Table Reference' component of the list object composite will contain the first row that is marked, based on the current sort order for the list. You can use the GetMarkedRecordCount() of the syListObj form to find out the number of rows that are marked.

Refresh event

If your list processing code is keeping track of which rows in the list are marked, it may be helpful to know when all of the rows in the list have been unmarked due to a “refresh” event. To be notified of this situation for your list, add the ClearMarkedRecordsEvent procedure to the list. This procedure must have the following parameter:

inout ListObjState list_object;


Documentation Feedback