apoc.when
Procedure
apoc.when(condition Boolean, ifQuery String, elseQuery String, params Map<String, Any>)
- this procedure will run the read-only ifQuery if the conditional has evaluated to true, otherwise the elseQuery will run.
Signature
apoc.when(condition :: BOOLEAN?, ifQuery :: STRING?, elseQuery = :: STRING?, params = {} :: MAP?) :: (value :: MAP?)
Input parameters
Name | Type | Default |
---|---|---|
condition |
BOOLEAN? |
null |
ifQuery |
STRING? |
null |
elseQuery |
STRING? |
|
params |
MAP? |
{} |
Usage examples
CALL apoc.when(false, 'RETURN 7 as b');
value |
---|
{} |
CALL apoc.when(true, 'RETURN $a + 7 as b', 'RETURN $a as b',{a:3})
value |
---|
{b: 10} |
Was this page helpful?