This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v20.6
ARRAY OBJECT
|
ARRAY OBJECT ( arrayName ; size {; size2} ) | ||||||||
Parameter | Type | Description | ||||||
arrayName | Array |
![]() |
Name of array | |||||
size | Longint |
![]() |
Number of array elements or Number of arrays if size2 is specified | |||||
size2 | Longint |
![]() |
Number of 2D array elements | |||||
The ARRAY OBJECT command creates and/or resizes an array of language Object type elements in memory.
The arrayName parameter is the name of the array. You can use any name that conforms to 4D conventions.
The size parameter is the number of array elements.
The size2 parameter is optional. If you pass it, this command creates a two-dimensional array. In this case, size specifies the number of rows and size2 the number of columns in each array. Each row in a two-dimensional array can be processed both as an element and an array. This means that when you work with the first dimension of a two-dimensional array, you can insert and remove entire arrays using other commands in the "Arrays" theme.
When you apply the ARRAY OBJECT command to an existing array:
Creation of a process array of 100 Object-type elements:
ARRAY OBJECT(arrObjects;100)
Creation of a local array of 100 rows each containing 50 Object-type elements:
ARRAY OBJECT($arrObjects;100;50)
Creation and filling of a local object array:
C_OBJECT($Children;$ref_richard;$ref_susan;$ref_james)
ARRAY OBJECT($arrayChildren;0)
OB SET($ref_richard;"name";"Richard";"age";7)
APPEND TO ARRAY($arrayChildren;$ref_richard)
OB SET($ref_susan;"name";"Susan";"age";4)
APPEND TO ARRAY($arrayChildren;$ref_susan)
OB SET($ref_james;"name";"James";"age";3)
APPEND TO ARRAY($arrayChildren;$ref_james)
// $arrayChildren{1} -> {"name":"Richard","age":7}
// $arrayChildren{2} -> {"name":"Susan","age":4}
// $arrayChildren{3} -> {"name":"James","age":3}
Product: 4D
Theme: Arrays
Number:
1221
Created: 4D v14
4D Language Reference ( 4D v20)
4D Language Reference ( 4D v20.1)
4D Language Reference ( 4D v20.2)
4D Language Reference ( 4D v20.3)
4D Language Reference ( 4D v20.4)
4D Language Reference ( 4D v20.5)
4D Language Reference ( 4D v20.6)