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

boolean

boolean

The boolean function in XQuery is used to convert its argument to a boolean value according to specific rules.

Syntax

fn:boolean(arg)
The following table describes the argument for this command:
Argument
Required/
Optional
Description
arg
Required
The sequence to be converted into a boolean. It can be an atomic value, a sequence of nodes, or an empty sequence. It can contain zero or more items.

Return Value

  • If the sequence is empty, the result is
    false
    .
  • If the sequence contains a single boolean value, that value is returned.
  • If the sequence contains a single numeric value,
    false
    is returned for
    0
    or
    NaN
    , and
    true
    for any other numeric value.
  • If the sequence contains a single string,
    false
    is returned for an empty string, and
    true
    for any other string.
  • For nodes, the existence of nodes in a sequence determines the truth value:
    true
    for a non-empty sequence, and
    false
    for an empty one.
  • If the sequence contains more than one item and none of these conditions apply, an error occurs.

Examples

The following table lists some sample values and return values:
Input
Return Value
fn:boolean( () )
false
fn:boolean('')
false
fn:boolean(0)
false
fn:boolean('0')
true
fn:boolean('false')
true
fn:boolean(("Hello"))
true
fn:boolean(xs:float('NaN'))
false
fn:boolean($ordDoc/order[1])
true
fn:boolean($ordDoc/noSuchChild)
false
fn:boolean(<a>false</a>)
true

0 COMMENTS

We’d like to hear from you!