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.

How to replace the null property with a 'NULL' String?

While reading a elastic index into neo4j, there are fields with null values, I use below code to read and get the error

MERGE (applicationgisno:ApplicationGISNo {appgis: applicant.GIS_No})
MERGE (doc)-[:GIS_No]->(applicationgisno)

#if the value is null in json, then we get
Neo.ClientError.Statement.SemanticError: Cannot merge node using null property value for appgis

May I know how to use say if condition here, if that value is null then replace with a string "NULL" to create the node in graph?

3 REPLIES 3

Thanks found it

MERGE (applicationgisno:ApplicationGISNo {appgis: COALESCE(applicant.GIS_No, 'NULL') })
MERGE (doc)-[:GIS_No]-> (applicationgisno)

For all non id fields I would not want to do that though as it just wastes space

while loading the data, only few records have null, say for example 10 records, only 2 records have null in GISNo, May I how should I load the data without that? If I load the GISNO it through Error.