[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
+---------------------------------+
| ALEN |
+---------------------------------+
ALEN(<array> [, <expN>])
-----------------------------------
Returns number of elements, rows or columns in array.
Return value - Numeric
-----------------------------------
<array>
Name of array.
<expN>
If 0, returns number of elements.
If 1, returns number of rows.
If 2, returns number of columns.
+---------------------------------+
| Examples |
+---------------------------------+
DIMENSION x(5)
DIMENSION y(3,7)
? ALEN(x)
? ALEN(x,0)
? ALEN(x,1)
? ALEN(x,2)
? ALEN(y)
? ALEN(y,1)
? ALEN(y,2)
SELECT DISTINCT state FROM customers INTO ARRAY states
? ALEN(states)
+---------------------------------+
| Program Example |
+---------------------------------+
The example below copies COMPANY field from CUSTOMER database to memory
variable array COMPANIES. COMPANIES array is initialized with one row
and one column. ALEN() returns number of rows in database so that
COMPANIES can be dynamically redimensioned, if necessary, to contain as
many rows as CUSTOMER database. Then COPY TO ARRAY command copies
COMPANY field to COMPANIES array.
IF USED('customer')
SELECT customer
ELSE
USE LOCFILE('customer.dbf','DBF','Where is CUSTOMER.DBF?')
ENDIF
DIMENSION companies(1,1)
COUNT TO m.count
IF m.count > ALEN(companies)
*** Array too small, need to redimension ***
DIMENSION companies(m.count,1)
ENDIF
COPY TO ARRAY companies FIELD Company
-----------------------------------
See Also: DECLARE, DIMENSION, STORE
-----------------------------------
See Also:
DECLARE
DIMENSION
STORE
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson