About Arrays

Within computing, an array of data can be thought of as the equivalent of a table of numbers (or text strings). A single dimension array is like a row of items across a page:

Mon

Tue

Wed

Thu

Fri

Sat

Sun

 

A two dimension array represents a table of rows and columns:

Week

1

2

3

4

5

Monday

1

8

15

22

29

Tuesday

2

9

16

23

30

Wednesday

3

10

17

24

1

 

Sometimes groups of data are more easily stored as arrays, since the data can be referenced using index numbers representing the “row” and “column” position of the data.

You can use this method to store data within PCIs by allowing the use of one or more indices in a variable name. Variables as indices, enclosed in [ ], will be evaluated.

 
For example, in a one dimensional array,

myarray(1)

 
indicates element “1” in “myarray”

 

Example of one dimensional array

 
In a two dimensional array,

calendar(3,5)

 
indicates the element in “row” 3, “column” 5 of table “calendar”.

Example of two dimensional array

 

You can place data in an array by structuring the variable name. For example,

%CALC=stock(1,5)=30

places value 30 in variable stock(1,5), and

%MessageBox=Value is [stock(1,5)]

makes use of that same data.

See Also

Example of a One Dimensional Array
Mixing String and Numeric Variables

Evaluating Variables in an Array

Example of a Two Dimensional Array