Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
01-27-2023 09:58 PM - edited 01-27-2023 10:04 PM
:param prameter=> 'name';
with $prameter as par
match (u:user) where con[par] is not null with u,par
merge (d:details {par:u[par]}) return d
-- the above one is neo4j considering "merge (d:details {par" <- par as a property name but I want to pass name as property could any one please suggest on this.
match (u:user) where con[$prameter] is not null with u,$prameter
merge (d:details {$prameter:u[$prameter]}) return d
when I run aboe it is throwing error
Invalid input '{': expected a parameter (line 3, column 16 (offset: 105))
01-28-2023 05:06 AM - edited 01-28-2023 06:01 AM
You can not use a variable as a key in a map, in your first query m, ‘par’ will be be the key; it will not use the value of par as the key. In your second query, you are getting an error because you can not use an expression as a key, $parameter can not be the key. To do what you want, you can create a map with dynamic keys using an apoc function and set the nide variable to the map or use apoc.merge.node and pass the property map.
https://neo4j.com/labs/apoc/4.1/overview/apoc.merge/apoc.merge.node/
https://neo4j.com/labs/apoc/4.1/overview/apoc.map/apoc.map.fromLists/
All the sessions of the conference are now available online