apoc.caseProcedureDeprecated in Cypher 25
|
This procedure is deprecated. Use Cypher’s conditional queries instead. |
|
This procedure is not considered safe to run from multiple threads. It is therefore not supported by the parallel runtime. For more information, see the Cypher Manual → Parallel runtime. |
Syntax |
|
||
Description |
For each pair of conditional and read-only queries in the given |
||
Input arguments |
Name |
Type |
Description |
|
|
A list of conditionals, where each conditional is a pair: the first element is a predicate, and the second is a Cypher query to be executed based on that predicate. |
|
|
|
A Cypher query to evaluate if all conditionals evaluate to false. The default is: ''. |
|
|
|
A map of parameters to be used in the executed Cypher query. The default is: |
|
Return arguments |
Name |
Type |
Description |
|
|
The result returned from the evaluated Cypher query. |
|
Usage examples
CALL apoc.case([
false, 'RETURN "firstFalse" as b',
false, 'RETURN "secondFalse" as b',
true, 'RETURN "firstTrue" as b'
])
WHEN false THEN RETURN {b: "firstFalse"} AS value
WHEN false THEN RETURN {b: "secondFalse"} AS value
WHEN true THEN RETURN {b: "firstTrue"} AS value
| value |
|---|
{b: "firstTrue"} |
CALL apoc.case([
false, 'RETURN "firstFalse" as b',
false, 'RETURN "secondFalse" as b',
false, 'RETURN "thirdFalse" as b'
],
'RETURN "elseBranch" as b'
)
WHEN false THEN RETURN {b: "firstFalse"} AS value
WHEN false THEN RETURN {b: "secondFalse"} AS value
WHEN false THEN RETURN {b: "thirdFalse"} AS value
ELSE RETURN {b: "elseBranch"} AS value
| value |
|---|
{b: "elseBranch"} |