cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Error in cypher query

kashu94
Node Clone

I'm loading data from a csv file and when I see an already existing edge attribute, then I want to pass that already existing edge attribute else it'll be blank. I'm getting the following when trying to run this cypher query ...

Cypher query 

LOAD CSV WITH HEADERS FROM $csv_file_path AS line 
// FOR UPDATING QUANTITY DATA
MATCH (d:Diagnosis)
WHERE d.diagnosis_id=line.diagnosisID
MERGE (t:Treatment {treatment_id:line.treatmentID})
MERGE (d)-[r:DiagnosisToTreatment]-(t)

WITH apoc.convert.fromJsonMap(replace(CASE WHEN EXISTS r.qty_dict THEN r.qty_dict ELSE {} END, '`', '')) as map, apoc.convert.fromJsonMap(replace(line.qty_dict, '`', '')) as map1
............

The error I'm getting is:
Query failed: {code: Neo.ClientError.Statement.SyntaxError} {message: Invalid input 'r': expected

 

 

1 ACCEPTED SOLUTION

Instead of ‘exists’ try ‘is not null’  also, does the else value have to be a string, I.e. ‘{}’ ?

View solution in original post

2 REPLIES 2

Instead of ‘exists’ try ‘is not null’  also, does the else value have to be a string, I.e. ‘{}’ ?

kashu94
Node Clone

Thanks