Loading TOC...


   target as Sequence,
   position as Number
) as Sequence


Returns a new sequence constructed from the value of $target with the item at the position specified by the value of $position removed.

If $position is less than 1 or greater than the number of items in $target, $target is returned. Otherwise, the value returned by the function consists of all items of $target whose index is less than $position, followed by all items of $target whose index is greater than $position. If $target is the empty sequence, the empty sequence is returned.

For detailed type semantics, see Section 7.2.11 The fn:remove function[FS].

target The sequence of items from which items will be removed. If you pass in a single value, it is treated as a Sequence with that single item; therefore, if you pass in an array, the array is treated as a single value (not as one value for each item in the array). If you mean to pass in the values of each item in the array, then you can call xdmp.arrayValues on the array.
position The position in the target sequence from which the items will be removed.


const x = xdmp.arrayValues(["a", "b", "c"]);
fn.remove(x, 0);
=> ("a", "b", "c")

const x = xdmp.arrayValues(["a", "b", "c"]);
fn.remove(x, 1);
=> ("b", "c")

const x = xdmp.arrayValues(["a", "b", "c"]);
fn.remove(x, 6);
=> ("a", "b", "c")

const x = xdmp.arrayValues(["a", "b", "c"]);
fn.remove(null, 3);
=> ()

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.