The following example relates two tables to create a view consisting of two fields from each table, then uses DECLARE to create an array Compsumm and copies the selected data to the array. The counting DO WHILE loop displays the contents of the array to the results pane of the Command window:

CLOSE ALL

CLEAR
USE Contact IN SELECT() ORDER CompCode
USE Company IN SELECT()
SELECT Company
SET RELATION TO CompCode INTO Contact

DECLARE Compsumm[5,4]     // Create an array of
              // 5 rows and 4 columns
COPY TO ARRAY Compsumm NEXT 5;
FIELDS Company->Company, ;
Company->City, Contact->CompCode, ;
Contact->Contact
Cnt=1
DO WHILE Cnt<=5
  ? Compsumm[Cnt,1], Compsumm[Cnt,2]
  ?? Compsumm[Cnt,3], Compsumm[Cnt,4]
  Cnt=Cnt+1
ENDDO
CLOSE ALL