To meet your needs, we constantly work to improve Querix products.
This means that Lycia documentation is developing as well.
In case you have found a certain dissonance between the provided information and the actual behavior of Lycia 3 and/or your applications, please, let us know about this via documentation@querix.com so that we can introduce the necessary changes to our documentation.
Thank you for your attention and cooperation.
DYNAMIC ARRAY data type works the same way as ARRAY data type, but it has some additional features. Use the following syntax to declare a single-dimensional dynamic array of variables:
Element |
Description |
4GL Data Type |
Any Querix 4GL or user-defined data type except ARRAY, DYNAMIC ARRAY |
Dynamic arrays differ from traditional 4GL program arrays in that they do not have a fixed size. Attempts to into a dynamic array will cause the array to resize automatically, whereas it is impossible to write beyond the bounds of a static program array.
A multi-dimensional dynamic array is declared using the following syntax:
Element |
Description |
4GL Data Type |
Any Querix 4GL or user-defined data type except ARRAY, DYNAMIC ARRAY |
Integer Expression |
A 4GL expression returning a positive integer or a literal integer in the range from 1 to 3 which denotes the number of array dimensions |
There exists a number of restrictions imposed on multi-dimensional dynamic arrays. They are as follows:
1. .getLength() method is not supported. E.g., for:
DEFINE a DYNAMIC ARRAY WITH 2 DIMENTIONS OF datatype
valid usage:
a[index].getLength()
invalid usage, resulting in a compile time error:
a.getLength()
2. DISPLAY ARRAY statement can be used only for the arrays of the RECORD data type display.
3. The same limitations as for the static arrays:
definition: array length must always be greater than '0', otherwise an application fails to compile;
verification of indices it bounds: on an attempt to access by the index falling outside beyond the range, a compile time error occurs
A two-dimensional dynamic array declaration:
DEFINE x DYNAMIC ARRAY WITH 2 DIMENSIONS OF INTEGER
...
FOR i = 1 TO 100
FOR j = 1 TO 100
LET x[i,j] = i*j MOD 7
END FOR
END FOR
A three-dimensional dynamic array declaration:
DEFINE x DYNAMIC ARRAY WITH 3 DIMENSIONS OF INTEGER
...
FOR i = 1 TO 10
FOR j = 1 TO 10
FOR k = 1 TO 10
LET x[i,j,k] = i*j*k MOD 13
END FOR
END FOR
END FOR
Here is the list of methods used to manipulate variables of a DYNAMIC ARRAY type:
adds a new element after the last element of the array |
|
adds a new element with the NULL value to the array (takes no parameters) |
|
inserts a new array element to the specified position |
|
inserts an empty array element to the specified position |
|
resizes the single-dimensional array to the specified size |
|
returns the size of a single-dimensional array |
|
returns the length of a single-dimensional array |
|
removes all the specified array elements within the given range or at the given position |
|
removes the specified array element |
|
sets all the elements to NULL (in a static array) or removes all the elements (in a dynamic array) |