Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
01-10-2022 10:56 AM
Hi! I am using apoc.coll.frequencies, and I get the following as my output.
[
{
"item": "Aboriginal",
"count": 7
},
{
"item": "Afghan",
"count": 9
},
{
"item": "Afghani",
"count": 3
}
]
I now just want to convert this to a tabular view so I get
(row) item count
1 Aboriginal 7
2 Afghan 9
3 Afghani 3
What is the best way to do this?
01-10-2022 03:28 PM
Not sure if this is acceptable, but how about an array of arrays, where each element is row in your table?
with [{item:"Aboriginal", count: 7},{item:"Afghan", count: 9},{item:"Afghani", count: 3}] as data
with data, range(0,size(data)-1) as indexes
unwind indexes as index
with [['row', 'item', 'count']]+collect([index+1, data[index].item, data[index].count]) as rows
unwind rows as row
return row
All the sessions of the conference are now available online