Skip to content

Next_Selected_Item - dbList_

Returns the next selected item in a list

Type: Function
Return Data Type: Integer

Parameters

Parameter Type Description
ClFg Integer If true, the item is removed from the list of selected items

Syntax

Function Next_Selected_Item Integer ClFg Returns Integer

Call Example

Get Next_Selected_Item ClFg to IntegerVariable

Description

Next_Selected_Item returns an identifier of the next selected item after the previously returned item in an enumeration of selected items in a list, or returns -1 if there are no more selected items. If the ClFg parameter is True, the item's Select_State is reset to False; otherwise, it is left unchanged. If Batch_State is false, the record for the next selected item is found (using Read_by_Recnum, if the list has a Server). Enumeration_counter is also incremented unless there are no more selected items.

When processing all of the items in a multi-select dbList (Select_Mode = Multi_Select), you should always: 1. Call Init_Selected_Item to start initialize the processing. 2. Call Next_Selected_Item until the item returned is -1.

Do not use First_Selected_Item to start the enumeration. It does not initialize the list.

Sample

Send Init_Selected_Item
// the bClearItem parameter determines if the item should be cleared after
// you've selected it. If you do this, you can only traverse the list once.
Get Next_Selected_item bClearItem to iItem
While (iItem>=0)
    Send ProcessThisItem iItem
    Get Next_Selected_Item bClearItem to iItem
End

If the list is a batch list (determined by Batch_State), the list's item number is returned. If the list is non-batch, the record number (Recnum) value is returned.

Col 1 Col 2
Note: As of DataFlex 11.0, we advise that you use Next_Selected_Item for batch lists (which return items) and NextSelectedRowId for non-batch lists (which returns RowIds). This allows you to use standard tables that do not have a Recnum column. In either case, you should still send Init_Selected_Item before starting the process.

Return Value

Col 1 Col 2
If batch_state is true Returns the item number of the first selection item
If batch_state is false Returns the record number of the first selection item
If there are no selected items Returns -1

Syntax

Function Next_Selected_Item Integer ClFg Returns Integer
Col 1 Col 2
Call: Get Next_Selected_Item ClFg to IntegerVariable

Description

Next_Selected_Item returns an identifier of the next selected item after the previously returned item in an enumeration of selected items in a list, or returns -1 if there are no more selected items. If the ClFg parameter is True, the item's Select_State is reset to False; otherwise, it is left unchanged. If Batch_State is false, the record for the next selected item is found (using Read_by_Recnum, if the list has a Server). Enumeration_counter is also incremented unless there are no more selected items.

When processing all of the items in a multi-select dbList (Select_Mode = Multi_Select), you should always: 1. Call Init_Selected_Item to start initialize the processing. 2. Call Next_Selected_Item until the item returned is -1.

Do not use First_Selected_Item to start the enumeration. It does not initialize the list.

Sample

Send Init_Selected_Item
// the bClearItem parameter determines if the item should be cleared after
// you've selected it. If you do this, you can only traverse the list once.
Get Next_Selected_item bClearItem to iItem
While (iItem>=0)
    Send ProcessThisItem iItem
    Get Next_Selected_Item bClearItem to iItem
End

If the list is a batch list (determined by Batch_State), the list's item number is returned. If the list is non-batch, the record number (Recnum) value is returned.

Col 1 Col 2
Note: As of DataFlex 11.0, we advise that you use Next_Selected_Item for batch lists (which return items) and NextSelectedRowId for non-batch lists (which returns RowIds). This allows you to use standard tables that do not have a Recnum column. In either case, you should still send Init_Selected_Item before starting the process.