cancel
Showing results for 
Search instead for 
Did you mean: 

Join the community at Nodes 2022, our free virtual event on November 16 - 17.

How can I get error messages or return code from apoc.cypher.runMany?

mprast
Node

Hi all,
I can't find anything that looks like an error message in the data structure that comes back from apoc.cypher.runMany(), even when I feed it a query string that's just garbage. Is there any way to see what went wrong if there is an issue with the query string? If not, how do I run multiple statements in a single round trip to neo4j in a way that lets me see errors? Do I have to make a separate request for each statement?

FYI, I'm using the node client, version 4.4.2. Thanks for your help!

-Matt

3 REPLIES 3

mprast
Node

Doing a little more research, it seems I can nest multiple unrelated statements into one using WITH clauses? Is this the recommended way to do it? I can't find any examples of this in the docs, and actually apart from a few hints I can't tell if it's even possible. I'll give it a shot though

The WITH clause allows you to chain together related cypher statements so you can further process the results passed in the WITH clause.

Here is a limited example:
match (n:People{name:’Sam’})-[:OWNS]->(e:Equipment)
With e
//cypher to do something with the equipment records
//only the items listed in the with clause are in scope
Return a, b //results of processing equipment records

mprast
Node

Okay, chaining WITHs together looks like it will work for my purposes. I'll leave this post up in case anyone else is in the same situation.