4D v16.3

ARRAY TIME

Home

 
4D v16.3
ARRAY TIME

ARRAY TIME 


 

ARRAY TIME ( arrayName ; size {; size2} ) 
Parameter Type   Description
arrayName  Array in Name of array
size  Longint in Number of array elements or Number of arrays if size2 is specified
size2  Longint in Number of 2D array elements

The ARRAY TIME command creates and/or resizes an array of Time type elements in memory.

Reminder:  In 4D, times can be processed as numeric values. In 4D versions prior to v14, you had to combine a longint array with a display format in order to manage an array of times. 

The arrayName parameter is the name of the array.

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 this theme. 

When you apply the ARRAY TIME command to an existing array:

  • If you enlarge its size, existing elements are not changed and new elements are initialized to the null time value (00:00:00).
  • If you reduce its size, elements at the "bottom" of the array are deleted and lost.

When you apply SELECTION TO ARRAY or SELECTION RANGE TO ARRAY to a Time type field, note that they only create a Time type array if the array has not already been defined as another type, such as Longint for example. 

This example creates a process array containing 100 Time-type elements:

 ARRAY TIME(arrTimes;100)

This example creates a local array of 100 rows each containing 50 Time-type elements:

 ARRAY TIME($arrTimes;100;50)

Since time arrays accept numeric values, the following code is valid:

 ARRAY TIME($arrTimeValues;10)
 $CurTime:=Current time+1
 APPEND TO ARRAY($arrTimeValues;$CurTime)
 $Found:=Find in array($arrTimeValues;$CurTime)



See also 

Creating Arrays
Time

 
PROPERTIES 

Product: 4D
Theme: Arrays
Number: 1223

This command can be run in preemptive processes

 
HISTORY 

Created: 4D v14

 
ARTICLE USAGE

4D Language Reference ( 4D v16)
4D Language Reference ( 4D v16.1)
4D Language Reference ( 4D v16.2)
4D Language Reference ( 4D v16.3)