I am trying to import from CSV where some lines have an account number and some don't. If the accounts have numbers that I would like to combine with them: there will be records in which the name in the account has changed, but the number will remain unchanged. For other entries without an account number, the best I can do is concatenate the account name.
So I really need some kind of conditional: if the line has an account number, merge on it, otherwise merge by the account name. Sort of...
LOAD CSV WITH HEADERS FROM 'file:///testfile.csv' AS line
MERGE (x:Thing {
CASE line.accountNumber WHEN NULL
THEN name: line.accountName
ELSE number: line.accountNumber
END
})
ON CREATE SET
x.name = line.accountName,
x.number = line.accountNumber
Although, of course, this does not work. Any ideas?
source
share