cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

need to run same script multiple times using loop which is having apoc procedures

:param node_id : 'id'
with $node_id as par
match (u:User) where u[par] is not null with u,par
with apoc.map.fromLists(
[par],
[u[par]]
) AS output
CALL apoc.merge.node(
["child"],
output
) yield node return node
 
I want to make the above script run for multiple times for other parameters using loop could you please suggest on this.
1 REPLY 1

You can use 'unwind' with a list of parameters to execute your script for each parameter in the list. The following is an example, although this script is not making sense as it is written. Can you provide a description of what you are trying to do?

unwind $node_id_list as par
match (u:User) where u[par] is not null 
with apoc.map.fromLists([par],[u[par]]) AS output
CALL apoc.merge.node(["child"],output) yield node 
return node