Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
11-17-2020 07:40 AM
Hi!
I'm trying to use CALL apoc.do.when() but I can't figure out how to use YIELD properly.
Here is my query:
LOAD CSV WITH HEADERS FROM "file:///example_drugs.csv" as drugs
MERGE (d:Drug {drugbankId: drugs.drugbankId})
SET d.name= drugs.name
SET d.description= drugs.description
SET d.casNumber= drugs.casNumber
SET d.unii= drugs.unii
SET d.state= drugs.state
WITH drugs.productName as productName, d
CALL apoc.do.when(productName IS NOT NULL,
"MERGE (p:Product{name: productName}) MERGE (d)-[r:HAS_PRODUCT]-(p)", YIELD ???)
return p
I tried to put YIELD in various places, but every time I get a error. Could someone help me with writing this query properly?
11-22-2020 12:53 AM
apoc.do.when requires both an if
and else
statement, it looks like you only have the first part.
Also yield
should appear outside of the function, e.g. the function yields a value:
CALL apoc.do.when(....) YIELD...
All the sessions of the conference are now available online