# Finish UNWIND list before executing new/next lines

**URL:** <https://community.neo4j.com/t/finish-unwind-list-before-executing-new-next-lines/18164>\
**Category:** Cypher\
**Created:** [May 5, 2020, 5:45pm UTC](https://community.neo4j.com/t/finish-unwind-list-before-executing-new-next-lines/18164 "2020-05-05T17:45:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![boadicea008](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/boadicea008/32/11172_2.png) [@boadicea008](https://community.neo4j.com/u/boadicea008)\
**Post date:** [May 5, 2020, 5:45pm UTC](https://community.neo4j.com/t/finish-unwind-list-before-executing-new-next-lines/18164/1 "2020-05-05T17:45:35Z")

</div>

Hello everyone!

This is another syntex doubt (that I couldn't find an answer elsewhere), now about UNWIND.  
As per my previous research I can't use FOREACH if I want to use MATCH after that. In this case UNWIND is recommended. Right?  
Below is a representative example. I even might be able to rewrite it to have a single UNWIND...

**BUT the main point is.... HOW COULD I force to go to next "item" in the "list" before executing new/next command line?**

.

```auto
01.	# Preparing and starting first UNWIND 
02.	WITH [101,102,103,104] as topusers
03.	UNWIND topusers as topuser 
04. MATCH ....
05. ....
06. # Preparing and starting second UNWIND
07. WITH topuser, .... as friends, [1,2,3,4,5,6] as list
08. UNWIND list as item
09. MATCH ....
10. ....
11. CASE .... value = value +1
12. ELSE .... value
13. END value
14. # Jump back to second UNWIND (line 08) to finish the list.... HOW TO DO IT????
15.	# For each "topuser", print "friends" and its final "value"
16.	RETURN topuser, friends, value

```

.  
The Neo4j version I'm using is 3.5.14.

Again, I really appreciate your help!!!  
🤩

---

<div class="post-metadata">

**Author:** ![stefan.armbruster](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/stefan.armbruster/32/74_2.png) [@stefan.armbruster](https://community.neo4j.com/u/stefan.armbruster)\
**Post date:** [May 6, 2020, 7:46pm UTC](https://community.neo4j.com/t/finish-unwind-list-before-executing-new-next-lines/18164/2 "2020-05-06T19:46:41Z")

</div>

One approach would be to filter the list to only contain those wanted for the unwind:

`unwind [x in list where <predicate>] as x ...`
