DEL

DEL, DELETE()

Top  Previous  Next

 

The DEL statement and DELETE() function delete a field, value or subvalue from a dynamic array. Used with a data collection, the DEL statement deletes an element.

 

 

Format

 

DEL dyn.array<field {, value {, subvalue}}>

DELETE(dyn.array, field {, value {, subvalue}})

DEL collection{path}

 

where

 

dyn.arrayis the dynamic array from which the item is to be deleted.

 

fieldevaluates to the number of the field to be deleted.

 

valueevaluates to the number of the value to be deleted. If omitted or zero, the entire field is deleted.

 

subvalueevaluates to the number of the subvalue to be deleted. If omitted or zero, the entire value is deleted.

 

collectionis a data collection variable.

 

pathis the element path of the data collection element to be deleted.

 

 

Dynamic Arrays

 

The specified field, value or subvalue is deleted from the dynamic array. The DEL statement assigns the result to the dyn.array variable. The DELETE() function returns the result without modifying dyn.array.

 

 

Data Collections

 

The collection element identified by the element path is deleted. If this is an array element, subsequent elements move back, reducing the array size. Note that when used in this way, the curly brackets surrounding the path are part of the syntax, not markers for optional items.

 

 

Examples

 

DEL ITEMS<1,N>

 

This statement deletes field 1, value N from dynamic array ITEMS.

 

 

S = DELETE(ITEMS, 1, N)

 

This statement is similar to the previous example except that the result is assigned to S, leaving ITEMS unchanged.

 

 

DEL CLIENT.DATA{'CONTACT.NAME', N}

 
The above statement deletes element N of the CONTACT.NAME array in the CLIENT.DATA collection.

 

 

 

See also:

Data collections, EXTRACT(), FIND, FINDSTR, INS, INSERT(), LISTINDEX(), LOCATE, LOCATE(), REPLACE()