4D v13.4

ARRAY TO LIST

Home

 
4D v13.4
ARRAY TO LIST

ARRAY TO LIST 


 

ARRAY TO LIST ( array ; list {; itemRefs} ) 
Parameter Type   Description
array  Array in Array from which to copy array elements
list  String in List into which to copy array elements
itemRefs  Array in Numeric array of item reference numbers

The ARRAY TO LIST command creates or replaces the list list (as defined in the Design environment List Editor) using the elements of the array array.

The optional itemRefs parameter, if specified, must be a numeric array synchronized with the array array. Each element, then, indicates the list item reference number for the corresponding element in array. If you omit this parameter, 4D automatically sets the list item reference numbers to 1, 2... N.

Compatibility Note: The ARRAY TO LIST command must be used with caution because of the following limitations:

  • Since this command modifies the application structure (lists are stored in the structure file), any modifications performed locally are lost when the structure file is updated during production.
  • This command cannot be used in a component because they are loaded with their structure as read only.
  • This command only lets you set first-level items of the list.

You can use ARRAY TO LIST to build a list based on the elements of an array. However, to free yourself from these restrictions and make full use of the lists of values, we recommend using the commands of the Hierarchical Lists theme.

Example  

The following example copies the array atRegions to the list called “Regions:”

 ARRAY TO LIST(atRegions;"Regions")

An error -9957 is generated when ARRAY TO LIST is applied to a list that is currently being edited in the Design environment List Editor. You can catch this error using an ON ERR CALL project method.

 
PROPERTIES 

Product: 4D
Theme: Arrays
Number: 287

This command modifies the Error system variable

 
INDEX

Alphabetical list of commands

 
HISTORY 

Created: < 4D v6

 
SEE ALSO 

LIST TO ARRAY
Load list
ON ERR CALL
SAVE LIST