Hi, I'm Ask INFA!
What would you like to know?
ASK INFAPreview
Please to access Ask INFA.

Table of Contents

Search

  1. Understanding Data Types and Field Properties
  2. Designing Processes
  3. Using and Displaying Data
  4. Designing Guides
  5. Designing Process Objects
  6. Designing Service Connectors
  7. Using App Connections
  8. System Services, Listeners and Connectors
  9. Designing Human Tasks

Design

Design

subsequence

subsequence

The subsequence function in XQuery is designed to retrieve a specific portion of a sequence based on a starting location and an optional length. It allows extracting parts of a sequence efficiently, focusing only on the desired segment.

Syntax

fn:subsequence(sourceSeq, startingLoc, length)
The following table describes the argument for this command:
Argument
Required/Optional
Description
sourceSeq
Required
The input sequence from which a subsequence will be extracted.
startingLoc
Optional
The 1-based position within
$sourceSeq
where the subsequence starts. Non-integer values are rounded to the nearest integer. If
$startingLoc
is less than 1, it adjusts appropriately to start from the beginning of the sequence.
length
Optional
The number of items to include in the subsequence. Non-integer values are rounded to the nearest integer. If not specified or if the value is such that the subsequence extends beyond the end of
$sourceSeq
, all remaining items are included.

Return Value

  • Returns the contiguous sequence of items in the value of
    $sourceSeq
    beginning at the position indicated by the value of
    $startingLoc
    and continuing for the number of items indicated by the value of
    $length
    .
  • If
    $startingLoc
    is beyond the end of the sequence or
    $length
    is 0 or negative, it returns an empty sequence.

Examples

The following table lists some sample values and return values:
SAMPLE FUNCTION
OUTPUT
fn:subsequence( ('a', 'b', 'c', 'd', 'e'), 3)
('c', 'd', 'e')
fn:subsequence( ('a', 'b', 'c', 'd', 'e'), 3, 2)
('c', 'd')
fn:subsequence( ('a', 'b', 'c', 'd', 'e'), 3, 10)
('c', 'd', 'e')
fn:subsequence( ('a', 'b', 'c', 'd', 'e'), 10)
()
fn:subsequence( ('a', 'b', 'c', 'd', 'e'), -2, 5)
('a', 'b')
fn:subsequence( (), 3)
()
fn:subsequence((5, 10, 15, 20), 2.5, 2.6)
15, 20

0 COMMENTS

We’d like to hear from you!