This function is used only in conjunction with switch()
function to create a switch case.
That allows you to create in FlexQuery expressions a construct similar to switch statement in Java
as shown in the following example:
switch (
val, // the value to match to switch cases
SwitchCase[] ( // create an array of cases
SwitchCase ( // create 1-st case
'A', // the matching value, which
// triggers that case
1 // the result to be returned in that
// case by switch() function
),
SwitchCase ( // create 2-nd case
'B', // the matching value
// instead of a single value, specify
// for that case a subquery to evaluate
FlexQuery ({
... // do something here
2 // the result to be returned by switch()
})
),
SwitchCase ( // create 3-rd case
// it matches several values at once
// specified in an array
Array ('C', 'D', 'E'),
// a subquery to evaluate in that case
FlexQuery ({
... // do something here
val // the result to be returned:
// the same value as passed
// to the switch()
})
)
),
// the default subquery: executed
// when none of the cases matched
FlexQuery ({
... // do something here
-1 // the result to be returned by switch()
})
);
matchingValue
matchingValues
resultValue
switch()
, when this case is processed.
resultQuery
The subquery must be created using FlexQuery()
function. The result it returns
will be that returned by the switch()
function call.
switch(), FlexQuery()