KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Using the new "Find in list" command
PRODUCT: 4D | VERSION: 11 | PLATFORM: Mac & Win
Published On: October 24, 2007

Find in list can search a Hierarchical List for matching text and return the position of matching list items or the reference ID of those items.

Note: when using this command and returning an item's position Find in list does not find list items in collapsed lists. For this reason it is usually necessary to use the reference ID instead, if you would like to search the entire list. Once the item has been found and returned via the Find in list command the reference ID can be used to open the list and display the item. Here is some sample code for that:

$itemRefID:=Find in list(*;"HList";"TexttoFind";1;$itemArray;*)
If ($itemRefID#0)
  $position:=List item position(*;"HList";$itemRefID)
  SELECT LIST ITEMS BY POSITION(*;"HList";$position)
  SCROLL LINES(*;"HList";$position)
Else
  `Insert how to deal with not finding a matching item
End if