KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
4D Summit: Using List Boxes as a Replacement for Output Forms
PRODUCT: 4D | VERSION: 11.2 | PLATFORM: Mac & Win
Published On: October 16, 2007
This technical article is currently restricted to 4D Summit attendees and Partners Only. Login with your Customer account to have full access to this article!!!
Log In

The list box was introduced in 4D 2004 as a replacement for grouped scrollable arrays. They are intermediate in sophistication and complexity between the scrollable arrays and plugins such as AreaList Pro, 4D View and 4D Column. Very quickly many 4D developers adopted the list box as their preferred way of displaying lists of records.
List boxes have the advantage of being 4D native and not a plugin. The price is very reasonable too...
Unfortunately in 2004 the list box could only display arrays and although you could use SELECTION TO ARRAY to display field data. The problem is if you have a lot of records (particularly if you are displaying a related field) then you will be waiting for a long time for the arrays to be loaded.
4D v11 extends the list box in two directions:

Direct display of fields
In 4D v11, it is possible to associate fields or expressions with list box columns. In previous versions, only arrays could be associated with list boxes.
When a list box is associated with a field, it can either work with the current selection of the database or with a named selection. In the case of the current selection, any modification done from the database side is automatically reflected in the list box, and vice versa. The current selection is therefore always the same in both places.

Display results of SQL queries
4D v11 includes a powerful SQL engine that can be used to carry out queries on the data (see the chapter "Using the 4D SQL Engine"). It is possible to place the results of an SQL query directly in a list box. Only queries of the SELECT type can be used.
In this session I will be dealing exclusively with the display of field data as an output form replacement using the list box tool.