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
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.