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()
  })
);
Parameter:

matchingValue

The case's matching value that triggers the processing of that case.
matchingValues
Instead of a single one, multiple matching values can be specified in an array, each of which will trigger the processing of the case.
resultValue
Specify the value to be returned by switch(), when this case is processed.
resultQuery
Instead of just returning a single value, you can specify a whole subquery to evaluate, when this case is processed.

The subquery must be created using FlexQuery() function. The result it returns will be that returned by the switch() function call.

See Also:
switch(), FlexQuery()