Import CSV With Optional Datetime Property

I'm completely new to Neo4j, so bear with me. I am trying to import a csv file where each row has an optional datetime value (some blank, some not). How could I import this data while applying the datetime() function to the rows where it's not null, and simply not setting that property when it is empty? (I don't want to skip the row, just that property).

Hello @peter.conrey

You can use the following hack to achieve what you want:

FOREACH (ignore IN CASE WHEN row.datetime IS NULL THEN [] ELSE [1] END | 
SET n.datetime = row.datetime)

where n is the node for which you want to set the optional property.

This will add the property only for those rows where datetime is not blank. Rest of the nodes will remain without the datetime property.

Hope this helps.

Thank you! That's exactly the solution I was looking for.