Log In    |    Knowledge Base    |    4D Home
Tech Note: The Hierarchical LIST TO ARRAY Command
Published On: January 1, 2000

Version 6 of 4th Dimension introduced hierarchical lists. This feature allows a list to contain more than a single, flat level of items — each item can now be a list in its own right containing additional items or even deeper levels of lists. Probably the most common place to find this type of interface element is in the Mac OS Finder, the Windows Explorer, or the NeXT Browser — where the hierarchical nature of a file system lends itself to an indented, outline list format.

A new set of commands for dealing with Hierarchical Lists (see Reference 1) was added to the language, and it is still possible to create and edit them manually using the List Editor in the Design Environment (see Reference 2). However, two commands that were very useful in previous versions of 4D for working with lists do not fully support the new hierarchical lists. LIST TO ARRAY (see Reference 3) only copies the first level items from a hierarchical list, and with ARRAY TO LIST (see Reference 4) only a flat, non-hierarchical list can be created. This Tech Note gives a method that copies an entire hierarchical list to a string array, along with an example showing how to print the resulting array.

Tech Note