IBM Integration Bus, Version 10.0.0.1 Operating Systems: AIX, HP-Itanium, Linux, Solaris, Windows, z/OS


SINGULAR function

The SINGULAR function returns a Boolean value that indicates whether a list contains exactly one element.

Syntax

Read syntax diagramSkip visual syntax diagram
>>-SINGULAR--(--ListExpression--)------------------------------><

If the list specified by ListExpression contains exactly one element, SINGULAR returns TRUE. If the list contains more or fewer elements, SINGULAR returns FALSE.

ListExpression is an expression that returns a list. All the following expressions, for example, return a list:
  • A LIST constructor
  • A field reference with the [] array indicator
  • Some SELECT expressions (not all return a list)

If you want to know only whether a list contains just one element or some other number, SINGULAR executes more quickly than an expression involving the CARDINALITY function (for example, CARDINALITY(ListExpression ) = 1).

A typical use of this function is to determine whether a field is unique.

Examples

-- Determine whether there is just one F1 field in the message.
-- Note that the [ ] are required
DECLARE Field1Unique BOOLEAN SINGULAR(OutputRoot.XMLNS.Data.Source.F1[]);
-- Determine whether there is just one field called F1 with the value 'F12'
-- in the message. Again note that the [ ] are required
DECLARE Field1F12Unique BOOLEAN
  SINGULAR(SELECT F.* FROM OutputRoot.XMLNS.Data.Source.F1[] AS F where F = 'F12'); 

ak05585_.htm | Last updated 2015-05-28 20:51:19