List item parent

4D - Documentation   Français   English   German   4th Dimension 2003, Command Theme List   4th Dimension 2003, Command Alphabetical List   4th Dimension 2003, Constant Theme List   Back   Previous   Next

version 6.0


List item parent (list; itemRef) Number

ParameterTypeDescription
listListRefList reference number
itemRefNumberItem reference rumber
Function resultNumberItem reference number of parent item
0 if none

Description

The command List item parent returns the item reference number of a parent item.

You pass a list reference number in list; you pass the item reference number of an item of the list in itemRef. In return, if the item reference number refers to an existing item in the list and if this item is in a sublist (and therefore has a parent item), you obtain the item reference number of a parent item.

If there is no item with the item reference number you passed or if the item has no parent, List item parent returns 0 (zero).

If you work with item reference numbers, build a list in which the items have unique reference numbers, otherwise you will not be able to distinguish the items. For more information, see the description of the command APPEND TO LIST.

Examples

Given the list named hList shown here in the User environment:

The item reference numbers are set as follows:

ItemItem Reference Number
a100
a - 1101
a - 2102
b200
b - 1201
b - 2202
b - 3203


In the following code, if the item "b - 3" is selected, the variable $vlParentItemRef gets 200, the item reference number of the item "b":

   $vlItemPos:=Selected list item(hList)
   GET LIST ITEM(hList;$vlItemPos;$vlItemRef;$vsItemText)
   $vlParentItemRef:=List item parent(hList;$vlItemRef) ` $vlParentItemRef
gets 200

If the item "a - 1" is selected, the variable $vlParentItemRef gets 100, the item reference number of the item "a".

If the item "a" or "b" is selected, the variable $vlParentItemRef gets 0, because these items have no parent item.

See Also

GET LIST ITEM, List item position, SELECT LIST ITEM BY REFERENCE, SET LIST ITEM.


4D - Documentation   Français   English   German   4th Dimension 2003, Command Theme List   4th Dimension 2003, Command Alphabetical List   4th Dimension 2003, Constant Theme List   Back   Previous   Next