Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
09-26-2018 02:53 AM
Good morning everyone,
I am developing my application in C# using the DevExpress XAF. In my application I have a series of custom views and I am starting to experiment with fetching data from my Neo4J DB and bind it to the XAF controller. To do this I am using the C# driver and running a cypher query that returns a list of JSON Objects:
MATCH (e:Environment)<-[:ENV]-(n:Component)-[APP]->(p:Application)
RETURN {objId: n.objId, objName: n.name,projName: p.name,projDesc: p.description,envName: e.name,envDesc: e.description} as obj
When I run the IDriver.Session().Run() I get a list of the JSON objects, I would rather though get a JSON array with my JSON objects so that I could bind that to the controller after deserializing it. I could iterate through the list that I do get from the Run method and build my JSON string but I wanted to know if there is a way to get the data directly formatted as an array.
Thanks,
Gustavo.
Solved! Go to Solution.
09-26-2018 03:38 PM
you can turn it into an array with the collect aggration function
MATCH (e:Environment)<-[:ENV]-(n:Component)-[APP]->(p:Application)
WITH {objId: n.objId, objName: n.name,projName: p.name,projDesc: p.description,envName: e.name,envDesc: e.description} as obj
RETURN collect(obj) as objects
09-26-2018 08:29 AM
I did the iteration through the results to build one unique string but it is extremely slow.
09-26-2018 03:38 PM
you can turn it into an array with the collect aggration function
MATCH (e:Environment)<-[:ENV]-(n:Component)-[APP]->(p:Application)
WITH {objId: n.objId, objName: n.name,projName: p.name,projDesc: p.description,envName: e.name,envDesc: e.description} as obj
RETURN collect(obj) as objects
09-27-2018 12:56 AM
Thank you Michael, that was exactly what I was looking for!
All the sessions of the conference are now available online