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.

Importing CSV with Null values

So I am having a CSV which has data like the below


Is it possible to import the csv and get something like the below?

Any reference to attain will also be helpful.

Thanks in advance.

3 REPLIES 3

ameyasoft
Graph Maven
You can use FOREACH

FOREACH(ignoreMe IN CASE WHEN row.Options is not null and row.Condition is not null  THEN [1] ELSE [] END|

	MERGE (a:Question {question: row.Question})
	MERGE (b:Condition {condition: row.Condition})
	MERGE (a)-[:MELLO_3]->(b)

)

Hey thanks for the response. I did like this

MERGE (a:Question {question: row.Question})
FOREACH(ignoreMe IN CASE WHEN row.Options is not null and row.Condition is not null  THEN [1] ELSE [] END|

	MERGE (b:Condition {condition: row.Condition})
	MERGE (a)-[:MELLO_3]->(b)

Because the solution you gave didn't create the node "Hello_4"

Hie,

So is there a way to call apoc inside the foreach condition, something like

FOREACH(ignoreMe IN CASE WHEN row.Option is not null and row.Condition is not null  THEN [1] ELSE [] END|
	MERGE (b:Condition {condition: row.Condition})
	with a,b,line
	CALL apoc.create.relationship(a, 'investigate',{relation:line.Option}, b) YIELD rel
	REMOVE rel.noOp
)