Click or drag to resize

ADel Function (Array, 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.19
Syntax
 FUNCTION ADel(
	ArrayName AS ARRAY,
	nElementNumber AS LONG,
	nDeleteType AS LONG
) AS DWORD
Request Example View Source

Parameters

ArrayName
Type: Array
Specifies the array from which the element, row, or column is deleted.
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.
Remarks
The parameter to this function is a 'General Array'. The function decides at runtime if the array is a FoxPro array or a 'General' Array
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