Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 1

DELETE function

Syntax
DELETE (dynamic.array, field#[ ,value#[ ,subvalue#] ])

Description
Use the DELETE function to erase the data contents of a specified field, value, or subvalue and its corresponding delimiter from a
dynamic array. The DELETE function returns the contents of the dynamic array with the specified data removed without changing the
actual value of the dynamic array.
dynamic.array is an expression that evaluates to the array in which the field, value, or subvalue to be deleted can be found. If
dynamic.array evaluates to the null value, null is returned.
field# is an expression that evaluates to the field in the dynamic array; value# is an expression that evaluates to the value in the field;
subvalue# is an expression that evaluates to the subvalue in the value. The numeric values of the delimiter expressions specify which
field, value, or subvalue to delete. The entire position is deleted, including its delimiting characters.
value# and subvalue# are optional. If they are equal to 0, the entire field is deleted. If subvalue# is equal to 0 and value# and field# are
greater than 0, the specified value in the specified field is deleted. If all three delimiter expressions are greater than 0, only the
specified subvalue is deleted.
If any delimiter expression is the null value, the DELETE function fails and the program terminates with a run-time error message.
If a higher-level delimiter expression has a value of 0 when a lower-level delimiter is greater than 0, the 0 delimiter is treated as if it
were equal to 1. The delimiter expressions are, from highest to lowest: field, value, and subvalue.
If the DELETE function references a subelement of a higher element whose value is the null value, the dynamic array is unchanged.
Similarly, if all delimiter expressions are 0, the original string is returned.

Examples
In the following examples a field mark is shown by F, a value mark is shown by V, and a subvalue mark is shown by S.
The first example deletes field 1 and sets Q to VAL1VSUBV1SSUBV2FFSUBV3SSUBV4:
R="FLD1":@FM:"VAL1":@VM:"SUBV1":@SM:"SUBV2":@FM:@FM:"SUBV3":@SM:"SUBV4"Q=DELETE (R,1)

The next example deletes the first subvalue in field 4 and sets the value of Q to FLD1FVAL1VSUBV1SSUBV2FFSUBV4:
Q=DELETE (R,4,1,1)

The next example deletes the second value in field 2 and sets the value of Q to FLD1FVAL1FFSUBV3SSUBV4:
Q=DELETE (R,2,2)

The next example deletes field 3 entirely and sets the value of Q toFLD1FVAL1VSUBV1SSUBV2FSUBV3SSUBV4:
Q=DELETE (R,3,0,0)

The next example deletes the second subvalue in field 4 and sets the value of Q to FLD1FVAL1VSUBV1SSUBV2FFSUBV3:
Q=DELETE (R,4,1,2)

You might also like