Click or drag to resize

ADel Function (FoxArray, Long, Long)

X#
Deletes an element from a one-dimensional array, or a row or column from a two-dimensional array.

Namespace:  XSharp.VFP
Assembly:  XSharp.VFP (in XSharp.VFP.dll) Version: 2.21
Syntax
 FUNCTION ADel(
	foxArray AS FOXARRAY,
	nElementNumber AS LONG,
	 nDeleteType AS LONG
) AS DWORD
Request Example View Source

Parameters

foxArray
Type: FoxArray
nElementNumber
Type: Long
Specifies the number of the element, row, or column to delete from the array. If the array is multidimensional, nElementNumber will specify the row. You must include the optional 2 argument to delete a column from the array. For more information on how to reference elements in an array, see DIMENSION Command.
nDeleteType
Type: Long

Return Value

Type: DWord
Numeric
Remarks
Deleting an element or row from an array doesn't change the size of the array; instead, the trailing elements, rows, or columns are moved towards the start of the array, and the last element, row, or column in the array is set to False (.F.). If you delete a column, values of the elements in the deleted column are set to False (.F.), but trailing elements are not moved. If the element, row, or column is successfully deleted, 1 is returned.
Examples
X#
 1CLOSE DATABASES
 2OPEN DATABASE (HOME(2) + 'Data\testdata')
 3USE customer     // Open customer table
 4SELECT company FROM customer ;
 5WHERE country = 'UK' ;
 6INTO ARRAY gaCompanies
 7gnCount = _TALLY
 8gcName = 'Seven Seas Imports'
 9CLEAR
10DISPLAY MEMORY LIKE gaCompanies
11gnPos = ASCAN(gaCompanies, gcName)   // Search for company
12IF gnPos != 0
13* Company found, remove it from the array
14= ADEL(gaCompanies, gnPos)
15gnCount = gnCount - 1
16ENDIF
17DISPLAY MEMORY LIKE gaCompanies
See Also