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

Building Queries and Data Views

 Previous Next Contents Index View as PDF  

Cast Functions

Cast functions process a source value as the argument and type cast the output to a different datatype. Type casting will typically fail if applied to more than one element. An empty list is allowed, but the result of the type casting will consist of an empty list. Type casting functions are more likely to generate exceptions at run time if the parameter cannot be converted to the corresponding type.

The following table describes Liquid Data data types that conform to the XQuery specification that you can use in type casting functions. For more information about data types, see the XQuery 1.0 and XPath 2.0 Functions and Operators specification. The following cast functions are available:

cast as xs:boolean

Converts the input to a boolean value (true or false).

If the input parameter is empty, the function returns an empty list. Otherwise, Liquid Data generates an error.

Data Types

Notes

This function uses the xf:boolean-from-string function.

XQuery Specification Compliance

Conforms to the current specification; however, Liquid Data does not accept the values "1" and "0" to represent true and false, as described in the W3C XML Schem document.

Examples

 


cast as xs:byte

Converts the input to a byte value.

Data Types

Notes

This function uses the xf:byte function.

This function will complete sucessfully only if the value cast is a numeric value greater than -128 or less than 128; all other values will fail.

XQuery Specification Compliance

Conforms to the current specification.

Examples

 


cast as xs:date

Converts the input to a date value.

Data Types

Notes

This function uses the xf:date function.

The string must contain a date in one of these formats:

where YYYY represents the year, MM represents the month (as a number), DD represents the day, hh and mm represents the number of hours and minutes that the timezone differs from GMT (UTC). Z indicates that the date is in the GMT timezone.

If the string cannot be parsed into a date value, Liquid Data generates an error.

XQuery Specification Compliance

Conforms to the current specification.

Examples

 


cast as xs:dateTime

Converts the input to a dateTime value.

Data Types

Notes

This function uses the xf:date function.

XQuery Specification Compliance

Conforms to the current specification.

Examples

 


cast as xs:decimal

Converts the input to a decimal value.

Data Types

Notes

This function uses the xf:decimal function.

XQuery Specification Compliance

Examples

 


cast as xs:double

Converts the input to a double precision value.

Data Types

Notes

This function uses the xf:double function.

XQuery Specification Compliance

Examples

 


cast as xs:float

Converts the input to a floating point value.

Data Types

Notes

This function uses the xf:float function.

XQuery Specification Compliance

Examples

 


cast as xs:int

Converts the input to an int value.

Data Types

Notes

This function uses the xf:int function.

XQuery Specification Compliance

Conforms to the current specification.

 


cast as xs:integer

Converts the input to an integer value.

Data Types

Notes

This function uses the xf:integer function.

XQuery Specification Compliance

Conforms to the current specification.

 


cast as xs:long

Converts the input to a long value.

Data Types

Notes

This function uses the xf:long function.

XQuery Specification Compliance

Conforms to the current specification.

 


cast as xs:short

Converts the input to a short value.

Data Types

Notes

This function uses the xf:short function.

XQuery Specification Compliance

Conforms to the current specification.

 


cast as xs:string

Converts the input to a string value.

Data Types

Notes

This function uses the xf:string function.

XQuery Specification Compliance

Examples

 


cast as xs:time

Converts the input to a time value.

Data Types

Notes

This function uses the xf:time function.

XQuery Specification Compliance

Conforms to the current specification.

Examples

 

Back to Top Previous Next