4D v13.4

CLEAR LIST

Home

 
4D v13.4
CLEAR LIST

CLEAR LIST 


 

CLEAR LIST ( list {; *} ) 
list  ListRef in List reference number
in If specified, clear sublists from memory, if any If omitted, sublists, if any, are not cleared

The CLEAR LIST command deletes the hierarchical list whose list reference number you pass in list.

Usually you will pass the optional * parameter, so all the sublists, if any, attached to items or subitems of the list will be deleted as well.

You do not need to clear a list attached to a form object via the Property List window. 4D loads and clears the list for you. On the other hand, each time you load, copy, extract from a BLOB, or create a list programmatically, call CLEAR LIST when you are through with the list.

To clear a sublist attached to an item (on any level) of another list currently displayed in a form, proceed as follows:

  1. Call GET LIST ITEM on the parent item to get the list reference of the sublist.
  2. Call SET LIST ITEM on the parent item to detach the sublist from the list item before clearing it.
  3. Call CLEAR LIST to clear the sublist whose reference number you obtained with GET LIST ITEM.

Within a clean-up routine that clears all objects and data that you no longer need (i.e., when a window is closed and a form unloaded), you may end up clearing a hierarchical list that may have already been cleared, depending on the user actions within the form. Use Is a list to clear the list only if necessary:

  ` Extract of clean-up routine
 If(Is a list(hlList))
    CLEAR LIST(hlList;*)
 End if

See example for the Load list command.

See example for the BLOB to list command.

 
PROPERTIES 

Product: 4D
Theme: Hierarchical Lists
Number: 377

 
INDEX

Alphabetical list of commands

 
HISTORY 

Created: 4D v6

 
SEE ALSO 

BLOB to list
Load list
New list