Building Queries and Data Views
|
Other Functions
The other functions folder is where the if-then-else function is in the Data View Builder.
xfext:if-then-else
The xfext:if-then-else function accepts the value of a boolean parameter to select one of two other input parameters.
Data Types
- Parameter1 data type: xs:boolean?
- Parameter2 data type: xs:anyValue?
- Parameter3 data type: xs:anyValue?
- Returned data type: xs:anyValue
Notes
The If-then-else function is an extended function. For more information about extended functions, see Naming Conventions.
Liquid Data examines the value of the first parameter. If the condition is true, Liquid Data returns the value of the second parameter (then). If the condition is false, Liquid Data returns the value of the third parameter (else). If the returned condition is not a boolean value, Liquid Data generates an error.
XQuery Specification Compliance
This is an extended function. Liquid Data converts it to an XQuery if-then-else expression.
Examples
- If (xf:true()) then 3 else "10" returns the value 3.
- If (xf:false()) then 3 else "10" returns the value "10."
- If ("true") then 3 else "10" generates a compile-time error because the condition is a string value and not a boolean value.