These two identical commands create new arrays or change the size of existing ones.
DIMENSION | DECLARE ArrayName( nRows [, nCols ] )
[, aArray2( nRows2 [, nCols2 ] )
...]FoxPro supports both one- and two-dimensional arrays. If only nRows is specified, a one-dimensional array is created. If both nRows and nCols are specified, you get a two-dimensional array. However, any two-dimensional array in FoxPro can be treated like a one-dimensional array at any time. See "DBF, FPT, CDX, DBC—Hike!" for more information on FoxPro's weird (but convenient) array handling.
Arrays in FoxPro can use either parentheses (as shown above) or square brackets to enclose their row and column information. We recommend square brackets to avoid confusion with functions. (We only used parentheses in the syntax above because we've been using square brackets to indicate optional clauses.)
If ArrayName exists when you issue DIMENSION or DECLARE, it's reshaped to match the new dimensions specified. Data is moved to the cell with the same element number as its original location (see AELEMENT() for an explanation of element numbers). Any new elements get a value of .F. Take a look at the aColCopy function under ACOPY() to see how to put the data back where it belongs when you add columns.
DIMENSION aMyArray[3], aMyOtherArray[10,17]
* Add to an existing array
SELECT category FROM masterlist INTO ARRAY aCategory
DIMENSION aCategory[ ALEN(aCategory, 1) + 1 ]
aCategory[ ALEN(aCategory, 1) ] = "Other"ACopy(), AElement(), ALen(), Array Manipulation, Local, Public
