First, a disclaimer: I am not an expert on Neo4j, but just an unexperienced graph enthusiast. I'm using Neo4j Browser version: 4.0.1 + Neo4j Server version: 3.5.12 (enterprise).
After unsuccessfully trying a million recipes from the internet, I finally realised that none of them will work unless you type them independently on Neo4j Desktop query editor!
Alternatively, you could type a semicolon (';') after each cypher statement, if you want to keep all statements in the same query window. In such case, you need to allow multi statements, ticking on Neo4j Browser settings > Enable multi statement query editor.
So, to make it explicit and easier for newbies like me, here we have a working example.
Initially, in the query editor, type:
:param props => [{name: 'John', age: 18}, {name: 'Phill', age: 23}]
This will save the above parameters in your system under the object props as:
{
"props": [
{
"name": "John",
"age": 18
},
{
"name": "Phill",
"age": 23
}
]
}
Then, in a BRAND NEW query editor window, type:
FOREACH (props IN $props | CREATE (a {name:props.name, age:props.age}))
and hopefully, you will get the msg:
Created 2 nodes, set 2 properties, completed after 7 ms.
Then, in order to flush these parameters from your system, so that they do not interfere with any further ones, type:
:params {}