op:case( $when as map:map+, $otherwise as item()* ) as map:map
This function returns the specified valueExpression
if
the specified valueExpression
is true
.
Otherwise, it returns null.
Parameters | |
---|---|
$when | One or more op:when expressions. |
$otherwise |
The value expression to return if none of the
op:when expressions is true .
|
xquery version "1.0-ml"; import module namespace op="http://marklogic.com/optic" at "/MarkLogic/optic.xqy"; let $employees := op:from-view("main", "employees") return $employees => op:select(("EmployeeID", op:as("cased", op:case(( op:when(op:eq(op:col("EmployeeID"), 2), "second"), op:when(op:eq(op:col("EmployeeID"), 3), "third")), "otherwise" )))) => op:result()
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.