4D v16.3APPEND TO LIST |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v16.3
APPEND TO LIST
APPEND TO LIST
The APPEND TO LIST command appends a new item to the hierarchical list whose list reference number you pass in list. You pass the text of the item in itemText. You can pass a string or text expression of up to 2 billion characters. You pass the unique reference number of the item(of the Longint type) in itemRef. Although we qualify this item reference number as unique, you can actually pass the value you want. Refer to the Managing Hierarchical Lists section for more information about the itemRef parameter. If you also want an item to have child items, pass a valid list reference to the child hierarchical list in sublist. In this case, you must also pass the expanded parameter. Pass True or False in this parameter so that the sublist is displayed expanded or collapsed respectively. The list reference you pass in sublist must refer to an existing list. The existing list may be a one-level list or a list with sublists. If you do not want to attach a child list to the new item, omit the parameter or pass 0. Even though they are both optional, the sublist and expanded parameters must be passed jointly. Tips
Here is a partial view of a database structure: The [Departments] and [Employees] tables contain the following records: You want to display a hierarchical list, named hlList, that shows the Departments, and for each Department, a child list that shows the Employees working in that Department. The object method of hlList is: ` hlList Hierarchical List Object Method In this example, there is only one reason to distinguish [Departments] items and [Employees] items: 1. We store record IDs in the item reference numbers; therefore, we will probably end up with [Departments] items whose item reference numbers are the same as [Employees] items. 2. We use the List item parent command to retrieve the parent of the selected item. If we click on an [Employees] item whose associated record ID is #10, and if there is also a [Departments] item #10, the [Departments] item will be found first by List item parent when it browses the lists to locate the item with the item reference number we pass. The command will return the parent of the [Departments] item and not the parent of the [Employees] item. Therefore, we made the item reference numbers unique, not because we wanted unique numbers, but because we needed to distinguish [Departments] and [Employees] records. When the form is executed, the list will look like this: Note: This example is useful for user interface purposes if you deal with a reasonably small number of records. Remember that lists are held in memory—do not build user interfaces with hierarchical lists containing millions of items.
See also
|
PROPERTIES
Product: 4D
HISTORY
Modified: 4D v11 SQL ARTICLE USAGE
4D Language Reference ( 4D v16) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||