[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

apoc.when

This procedure is not considered safe to run from multiple threads. It is therefore not supported by the parallel runtime (introduced in Neo4j 5.13). For more information, see the Cypher Manual → Parallel runtime.

Details

Syntax

apoc.when(condition, ifQuery [, elseQuery, params ]) :: (value)

Description

This procedure will run the read-only ifQuery if the conditional has evaluated to true, otherwise the elseQuery will run.

Input arguments

Name

Type

Description

condition

BOOLEAN

The predicate deciding if to run the `ifQuery`or not.

ifQuery

STRING

The Cypher statement to run if the condition is true.

elseQuery

STRING

The Cypher statement to run if the condition is false. The default is: ``.

params

MAP

The parameters for the given Cypher statement. The default is: {}.

Return arguments

Name

Type

Description

value

MAP

The result returned from the evaluated Cypher query.

Usage examples

CALL apoc.when(false, 'RETURN 7 as b');
Results
value

{}

CALL apoc.when(true, 'RETURN $a + 7 as b', 'RETURN $a as b',{a:3})
Results
value

{b: 10}