KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Retrieving all list item references and text programmatically
PRODUCT: 4D | VERSION: 2004 | PLATFORM: Mac & Win
Published On: July 1, 2005

The following is a generic method that retrieves the list item reference number and the associated list item text on any given list.

` Method: Get_ItemsInList

` Description: Return the array of list item references and item text

`

` Usage: Get_ItemsInList($listref_l;->$arrref_al;->$arrname_at)

C_LONGINT($1;$listref_l)

C_POINTER($2;$reflist_atp;$3;$itemtext_atp)

$listref_l:=$1

$reflist_atp:=$2

$itemtext_atp:=$3


C_LONGINT($cnt_l;$itemref_l;$sublist_l;$i)

C_TEXT($itemtext)

$cnt_l:=Count list items($listref_l)


For ($i;1;$cnt_l)

GET LIST ITEM($listref_l;$i;$itemref_l;$itemtext;$sublist_l)



If (Find in array($reflist_atp->;$itemref_l)=-1)

  APPEND TO ARRAY($reflist_atp->;$itemref_l)

  APPEND TO ARRAY($itemtext_atp->;$itemtext)

End if

If (Find in array($reflist_atp->;$sublist_l)=-1) & ($sublist_l>0)

  Get_ItemsInList ($sublist_l;$reflist_atp;$itemtext_atp)

End if

End for