Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
01-02-2019 09:33 AM
hi
i have 3 nodes with property name education
(node1)["education"] = "school1::uni1"
(node2)["education"] = "school3::uni1"
(node3)["education"] = "school3"
i want to count the unique string after splitting by delimiter "::"
so the final result would be like this
school1 1
school3 2
uni1 3
thank you for the support
01-02-2019 01:46 PM
There are a few ways to do this.
The easiest way is probably to UNWIND the collections from the split, then collect the distinct results:
match (n:Node)
with n, split(n.education, '::') as eduList
unwind eduList as edu
return collect(distinct edu) as edu
01-02-2019 09:49 PM
thank you for your help
but this will return all the string in one array
all i really want to achieve this
unique string and its count
once again thanks you
01-02-2019 11:55 PM
Okay, I missed that part. In that case it's enough to UNWIND the list from the split, then get the count of each entry. This won't collect the results, but it should work for you.
match (n:Node)
with n, split(n.education, '::') as eduList
unwind eduList as edu
return edu, count(edu) as count
01-31-2020 07:55 AM
It really helped me as well....
All the sessions of the conference are now available online