bea.com | products | dev2dev | support | askBEA
 Download Docs   Site Map   Glossary 
Search

Building Queries and Data Views

 Previous Next Contents Index View as PDF  

Aggregate Functions

Aggregate functions process a sequence as argument and return a single value computed from values in the sequence. Except for the Count function, if the sequence contains nodes, the function extracts the value from the node and uses it in the computation. The following aggregate functions are available:

xf:avg

Returns the average of a sequence of numbers.

Data Types

Notes

If the source value contains nodes, the value of each node is extracted using the xf:data function. If an empty list occurs, it is discarded.

If the source value contains only numbers, the Avg function returns the average of the numbers, which is the sum of the source sequence divided by the count of the source sequence.

If the source value is an empty list, the function returns an empty list.

If the source value contains non-numeric data, the function returns an error.

XQuery Specification Compliance

Liquid Data requires a list of double precision values instead of a list of items.

Examples

 


xf:count

Returns the number of items in the sequence in an unsigned integer.

Data Types

Notes

If the source value is an empty list, the function returns an empty list.

XQuery Specification Compliance

Liquid Data returns an integer value (xs:integer) instead of an unsigned int (xs:unsignedInt) value.

Examples

 


xf:max

Returns the maximum value from a sequence. If there are two or more items with the same value, the specific item whose value is returned is implementation-dependent.

Data Types

Notes

If the source value contains nodes, the value of each node is extracted using the xf:data function. If an empty list occurs, it is discarded.

All values in the list must be instances of one of the following types:

For example, if the list contains items with typed values that represent both decimal values and dates, an error will occur.

The values in the sequence must have a total order:

Both of these conditions must be true; otherwise, the function returns an error.

XQuery Specification Compliance

Examples

 


xf:min

Returns the minimum value from a sequence of numbers. If there are two or more items with the same value, the specific item whose value is returned is implementation-dependent.

Data Types

Notes

If the source value contains nodes, the value of each node is extracted using the Data function. If an empty list occurs, it is discarded.

After extracting the values from nodes, the sequence must contain only values of a single type.

The values in the sequence must have a total order:

Both of these conditions must be true; otherwise, the function returns an error.

XQuery Specification Compliance

Examples

 


xf:sum

Returns the sum of a sequence of numbers.

Data Types

Notes

If the source value contains nodes, the value of each node is extracted using the Data function. If an empty list occurs, it is discarded.

If the source value contains only numbers, the Sum function returns the sum of the numbers.

If the source value contains non-numeric data, the function returns an error.

If the input sequence is empty, the function returns an empty list.

XQuery Specification Compliance

Examples

 

Back to Top Previous Next