Skip to main content

This is documentation for Caché & Ensemble. See the InterSystems IRIS version of this content.

For information on migrating to InterSystems IRIS, see How to Migrate to InterSystems IRIS, available on the WRC Distributions page (login required).

DELETE

Deletes an element from a dynamic array.

Synopsis

DELETE(dynarray,f[,v[,s]])

Arguments

dynarray An expression that resolves to a dynamic array.
f An expression that resolves to an integer. Specifies the Field level of the dynamic array on which to perform the deletion. Fields are counted from 1.
v Optional — An expression that resolves to an integer. Specifies the Value level of the dynamic array on which to perform the deletion. Values are counted from 1 within a Field.
s Optional — An expression that resolves to an integer. Specifies the Subvalue level of the dynamic array on which to perform the deletion. Subvalues are counted from 1 within a Value.

Description

The DELETE function returns a dynamic array with one element deleted. It deletes both the data and the dynamic array delimiter. Which element to delete is specified by the f, v, and s integers. For example, if f=2 and v=3, this means delete the third value from the second field. If f=2 and v is not specified, this means to delete the entire second field.

The DELETE function and the DEL statement perform the same operation, with the following difference: DEL changes the supplied dynamic array; DELETE creates a new dynamic array with the specified change and leaves the supplied dynamic array unchanged.

Examples

The following example uses the DELETE function to delete the second value from the first field of a dynamic array:

cities="New York":@VM:"London":@VM:
"Chicago":@VM:"Boston":@VM:"Los Angeles"
PRINT cities
    ! Returns: "New YorkýLondonýChicagoýBostonýLos Angeles"
PRINT DELETE(cities,1,2)
    ! Returns: "New YorkýChicagoýBostonýLos Angeles"

Emulation

UniData systems differ in how they handle f, v, and s arguments set to 0. The $OPTIONS ATTR.0IS1 (“zero is one”) provides support for this UniData feature. UniData systems ignore v and s arguments that are set to a negative number.

See Also

Feedback