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

Table of Contents

Search

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

Design

Design

index-of

index-of

The index-of function in XQuery is used to find the positions of items in a sequence that are equal to a given search item. It returns a sequence of positions where the specified item occurs.

Syntax

fn:index-of(seqParam, srchParam, collation)
The following table describes the argument for this command:
Argument
Required/Optional
Description
seqParam
Required
The sequence of atomic values to be searched. This sequence can include strings, numbers, and booleans.
srchParam
Optional
The item for which you want to find the index positions within
$seqParam
.
collation
Optional
A string specifying the collation to use when comparing strings, if required. If omitted, the default collation is used.

Return Value

Returns a sequence of positive integers giving the positions within the sequence
$seqParam
of items that are equal to
$srchParam
. If no matches are found, it returns an empty sequence.

Examples

The following table lists some sample values and return values:
SAMPLE FUNCTION
OUTPUT
fn:index-of( ('a', 'b', 'c'), 'a')
1
fn:index-of( ('a', 'b', 'c'), 'd')
()
fn:index-of( (4, 5, 6, 4), 4)
(1, 4)
fn:index-of( (4, 5, 6, 4), 04.0)
(1, 4)
fn:index-of( ('a', 5, 6), 'a')
1
fn:index-of( (), 'a')
()
fn:index-of( (<a>1</a>, <b>1</b>), <c>1</c> )
(1, 2)

0 COMMENTS

We’d like to hear from you!