[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
+---------------------------------+
| AELEMENT |
+---------------------------------+
AELEMENT(<array>, <expN1>
[, <expN2>])
-----------------------------------
Returns array element's number from its row and column subscripts.
Return value - Numeric
-----------------------------------
Some FoxPro functions (ACOPY(), ASCAN() , ASORT() ... ) that manipulate
two-dimensional arrays require that elements be referred to by their
element number. AELEMENT() facilitates conversion from subscripts to an
element number for these functions. The corresponding row and column
subscripts may be returned from an element number with the ASUBSCRIPT()
function.
<array>
Name of one- or two-dimensional array.
<expN1>
Row subscript.
<expN2>
Column subscript.
+---------------------------------+
| Example |
+---------------------------------+
In example below, 2 by 3 (2 rows, 3 columns) array is created. DISPLAY
MEMORY shows contents of elements of the array listed in order by
element number.
DIMENSION x(2,3)
DISPLAY MEMORY LIKE x
+---------------------------------+
| Program Example |
+---------------------------------+
IF USED('customer')
SELECT customer
ELSE
USE LOCFILE('customer.dbf','DBF','Where is CUSTOMER.DBF?')
ENDIF
COUNT TO m.count
DIMENSION companies[m.count,2]
COPY TO ARRAY companies FIELD Cust_id,Company
*
* Note: first three elements will not be sorted.
*
= ASORT(companies, AELEMENT(companies,4,2))
@ 5,30 SAY 'List of Companies:'
@ 7,30 GET m.choice ;
FROM companies ;
RANGE 2 ;
SIZE 10,30 ;
DEFAULT 1
READ
CLEAR
USE
-----------------------------------
See Also: ASUBSCRIPT(), DECLARE, DIMENSION, DISPLAY MEMORY
-----------------------------------
See Also:
ASUBSCRIPT()
DECLARE
DIMENSION
DISPLAY MEMORY
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson