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

distinct-values

distinct-values

The distinct-values function in XQuery returns a sequence containing only the distinct atomic values from the provided sequence, effectively removing any duplicates.

Syntax

fn:distinct-values(arg, collation)
The following table describes the argument for this command:
Argument
Required/Optional
Description
arg
Required
The sequence of atomic values.
collation
Optional
The collation to use for comparing strings.

Return Value

Returns a sequence where duplicate values in
$arg
have been removed, keeping only one instance for each set of values that are equal (
eq
) to each other. Values of type
xs:untypedAtomic
are treated as
xs:string
for comparison purposes. If values cannot be compared because the
eq
operator is not defined for their types, these values are treated as distinct. The order of the returned sequence may vary depending on the implementation.

Examples

Consider the following XML sample:
let $in-xml := <in-xml> <a>3</a> <b>5</b> <b>3</b> </in-xml>
The following table lists some sample values and return values based on the above snippet:
SAMPLE FUNCTION
OUTPUT
fn:distinct-values( ('a', 'b', 'a') )
('a', 'b')
fn:distinct-values( (1, 2, 3) )
(1, 2, 3)
fn:distinct-values( ('a', 2, 3) )
('a', 2, 3)
fn:distinct-values( (xs:integer('1'), xs:decimal('1.0'), xs:float('1.0E0') ) )
1
fn:distinct-values($in-xml/*)
(3, 5)
fn:distinct-values( () )
()

0 COMMENTS

We’d like to hear from you!