Hi apoc community
Context:
- neo4j version: 3.4.7 (hosted on https://app.graphenedb.com/)
- apoc version: apoc-3.4.0.3-all
- topic is related to apoc.custom.asProcedure
Problem
I am playing around with the new apoc.custom.asProcedure functionality (a big thanks to @stefan.armbruster)
It works, registering a custom procedures was successful, same for calling the procedure.
First version of the procedure I have registered
CALL apoc.custom.asProcedure('treeitemlist',
substring(reduce(s="", x in [
'MATCH (z:C_tree_item)'
,'WHERE'
,'NOT z:T_tree_item_start'
,'AND z:T_tree_item_end' <-------THIS LINE CONTAINS THE ERROR . should have been: AND NOT z:....
,'WITH z order by z.line_index'
,'WITH collect(z) AS items'
,'RETURN items'
] | s+" "+x),1),'read',
[['items','LIST OF NODE']],[])
Unfortunately I made a mistake in my registered cypher statement (see source code above) when calling 'apoc.custom.asProcedure'.
I tried to fix it by calling again apoc.custom.asProcedure (see source code below), with the same procedure name but updated cypher statement. Still the registered procedure 'treeitemlist' is executed with the wrong cypher statement.
Next try to register procedure 'treeitemlist' with the correct cypher statement
CALL apoc.custom.asProcedure('treeitemlist',
substring(reduce(s="", x in [
'MATCH (z:C_tree_item)'
,'WHERE'
,'NOT z:T_tree_item_start'
,'AND NOT z:T_tree_item_end' <------THIS TIME THE STATEMENT IS CORRECT
,'WITH z order by z.line_index'
,'WITH collect(z) AS items'
,'RETURN items'
] | s+" "+x),1),'read',
[['items','LIST OF NODE']],[])
Seems that once a procedure is registered it is imposible to change the cypher statement. Is this correct?
That raises some more generic questions, but I will create a dedicated topic for them
Best
Markus