An array can be seen as a series of variables. Arrays are used to temporarily save a list of values with the purpose to use these values in the model at a later stage. In a model document arrays can have a name with square brackets [ ] behind it.
In the declaration of an array the number between the brackets in general represents the initial amount of the elements in the array. If elements are accessed in the array above the initial amount, the array will be automatically extended. The number between the brackets, as well as the brackets themselves are optional, the declared size of an array is only used to reserve the initial memory for the array.
There can also be a formula between these brackets, which can be calculated when the ITP Model is run.
It is not necessary that the initial length of the array is known when the array is declared; during the execution of the model the formula that determines the initial length of the array is calculated and thus the initial length of the array.
Note
Limitations
The following restrictions apply to arrays:
ARRAY declarations:
ARRAY TYPE array_name
ARRAY TYPE array_name [ formula ]
Rules:
Example
ARRAY BOOL valid_numbers [ 1000 ]
ARRAY NUMBER hour_rates [ 5 ]
ARRAY TEXT customer_names
Elements of the array get a value by assignment.
ASSIGN variable [ index_number or formula ] := formula
Example
ASSIGN valid_numbers [ 1 ] := FALSE
ASSIGN hour_rates [ 5 ] := 234,30
ASSIGN customer_names [ 5 + 9 ] := P.Initials + " " + P.Name
As can be seen in the example above, the index_number can also be the result of a formula.
In the last example ITP data retrieval is used to retrieve the customer's initials and name from the database to fill this array.
An element of an array can be placed in the result document by using the construction @( ):
Example
#
@( valid_numbers [ 1 ] )
@( hour_rates [ 5 ] )
@( customer_names [ 5 + 9 ] )
#
Results (given the example above):
FALSE
234,30
A Johnson (possible answer)