Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
07-16-2020 02:07 PM
I am creating an apoc procedure inside a apoc trigger. The error in the logs says this
"
org.neo4j.exceptions.SyntaxException: Variable node
not defined (line 1, column 26 (offset: 25))
"MATCH(p1:SPerson { name: node.name}) CREATE (p1)-[:Enrolled]->(c)"
"
My apoc trigger code
CALL apoc.trigger.add('loadEnrollments',
"UNWIND apoc.trigger.nodesByLabel($assignedLabels, 'Enrollment') AS node
MERGE (p1:SPerson { name: node.name, cell: node.cell, created_at: node.created_at})
WITH p1, node
MATCH (c:Course {name: 'Paradigm Shifting 101'})
MATCH (n:SPerson)
WITH p1, node, COUNT(n) as size
CALL apoc.do.when(
size>3,'MERGE (p1)-[:Waitlist]->(c)',
'MATCH(p1:SPerson { name: node.name}) CREATE (p1)-[:Enrolled]->(c)') YIELD value
DETACH DELETE node",
{ phase: 'after' });
07-17-2020 05:02 AM
your apoc.do.when
call lacks passing through the parameters for p1 and c, see https://neo4j.com/docs/labs/apoc/current/cypher-execution/conditionals/
07-17-2020 08:39 AM
Thanks Stefan. That worked.
Can you also please suggest me something on the following question. Your expertise is greatly appreciated.
All the sessions of the conference are now available online