KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: How to determine whether a list item contains a sublist
PRODUCT: 4D | VERSION: | PLATFORM: Mac & Win
Published On: June 20, 2002

Compatibility: 6.5.x , 6.7.x, and 6.8.x



If you need to determine whether a list item contains a sublist, this can be easily accomplished using the following command:

GET LIST ITEM (list; itemPos; itemRef; itemText{; sublist{; expanded}})


Parameter Type Description


list ListRef -> List reference number


itemPos Number -> Position of item in expanded lists


itemRef Number <- Item reference number


itemText String <- Text of the list item


sublist ListRef <- Sublist list reference number (if any)


expanded Boolean <- If a sublist is attached:


TRUE = sublist is currently expanded

FALSE = sublist is currently collapsed


By passing the optional parameter sublist it returns the list reference number of the sublist attached to the item. If the item has no sublist, subList returns zero (0).


Here's a sample of code:


C_LONGINT(hList)




$vlItemPos:=Selected list item(hList)

GET LIST ITEM (hList; $vlItemPos; itemRef; itemText;sublist;expanded)

If (sublist=0) `item has no sublist


 `do somethting

Else


 `do something

End if