DELETE Function

The DELETE function deletes an attribute, value, or subvalue from a specified dynamic array.

Format

array = DELETE(array, attr# [, value# [, subval#]])

Parameter(s)

array

Dynamic array to be changed.

attr#

An expression evaluating to the attribute number. If attr# is equal to 0, the entire array is deleted.

value#

An expression evaluating to the value number. If value# is omitted or equal to 0, the entire attribute is deleted.

subval#

An expression evaluating to the subvalue number. If subval# is omitted or equal to 0, the entire value is deleted.

Description

The DELETE function may be used to delete an attribute, value, or subvalue from an array.

If the attribute, value, or subvalue expressions evaluate to a negative number or a number greater than the number accessible, no action is taken. If the expression evaluates to a noninteger value, it is truncated to an integer value.

The DELETE function is not the same as using the REPLACE function to replace the element with the null string (""). The REPLACE function removes the data while leaving the delimiters intact, but the DELETE function removes the delimiters as well as the data. For example, replacing Attribute 2 of an array with "" leaves an empty Attribute 2, but deleting Attribute 2 forces Attribute 3 to become Attribute 2, Attribute 4 to become Attribute 3, and so on.

The DEL statement is an equivalent to the DELETE function. See DEL Statement for more information.

Example

To delete value 3 of Attribute 5 in the array RECORD, the code might read:

RECORD = DELETE(RECORD, 5, 3)

See Also

Statement and Function Reference