Denfining an array with 2 Dimensions

make

Member
Hi Peggers,

i want to use an Array with two Dimension in my Programm.
But in the Books i have i didnt find any help for this.

Can anyone help me ?

Greets

Make
 
Progress doesn't support 2 dimensional arrays - Only 1 dimension allowed I am afraid.

There are a number of ways around this. Probably the simplest is to multiply the x and y values to create a product key that can be used to access the specific element.

e.g. a 4 by 4 array has 16 possible data points. to retrieve the value in x=2 y=1, you multiply (x - 1) by 4 (the number rows to skip) and add y.
 

Crittar

Member
Another way round it is to use a temp table:

Code:
DEFINE TEMP-TABLE tt
  FIELD idx AS INTEGER
  FIELD f1 AS CHARACTER FORMAT 'x(8)' EXTENT 10
/* The format and extent of f1 to be whatever you need */
  INDEX idx idx.

Simply use idx as one dimension of the array and the subscript on array f1 as the other dimension.
 
Top