Lists and Sublists
A list is a group of related items homogeneous items collected into a single unit, the list. Every item in a list is assumed to have the same structure.
In Uniface, a list is handled as a string and the
individual list items are separated by the Uniface subfield separator. By default the subfield
separator is GOLD ;
(semicolon), but it is possible to redefine this per field.
(In code examples, GOLD ;
is shown as an underlined semicolon ;
).
Lists can be of two basic types:
- Indexed Lists—each list item can be referenced by a sequential number identifying its position in
the list, starting with 1. For example, in the list
English;French;German
, item 2 isFrench
- Associative Lists—each item consists of a pair of associated values separated by an equals sign
(IdPart
=
ValuePart), such as a property and its value, or a value and its representation. For example:A property list:
Color=255; Width=100; Depth=200; DisplayOnly; Charset=Ascii
A ValRep list:
EN=English; FR=French; DE=German
However, you can treat any list as an indexed list or an associative list. In an indexed list, there is no equal sign, so the ValuePart is the same as the IdPart. In an associative list, the pair of values can be retrieved by its position in the list.
Sublists
When a list item is itself a list, it is referred to as a sublist. Lists of sublists can be used to create a table-like structure similar to occurrences in a grid.
The illustrated list could be expressed as an
indexed lists or an associative lists, with the GOLD !
preceding GOLD
; as sublist separator. (In the following examples, extra spaces have been added for
readability.)
- An indexed list of indexed lists:
Netherlands !; 31 ; Canada !; 1 ; United Kingdom !; 44 ; United States !; 1 ; Japan !; 81 ; Australia !; 61
- An indexed list of associative lists:
CTRY=Netherlands !; CODE=31 ; CTRY=Canada !; CODE=1 ; CTRY=United Kingdom !; CODE=44 ; CTRY=United States !; CODE=1 ; CTRY=Japan !; CODE=81 ; CTRY=Australia !; CODE=61
- An associative list with nested index
items:
1=Netherlands !; 31 ; 2=Canada !; 1 ; 3=United Kingdom !; 44 ; 4=United States !; 1 ; 5=Japan !; 81 ; 6=Australia !; 61