I have a MERGE with an ON CREATE and ON MATCH condition. Within the ON MATCH condition I'm checking to see if the value in the row (imported from Excel) is different than the one in the node. If it is, I want to update it and another property. However, I'm getting an error I don't quite understand. It is possible to update (via a SET statement) more than one property inside of a FOREACH statement? Here is the sample Cypher script:
call apoc.load.xls('Test File.xlxs', 'Company',
// the file has a header row
{header:true}
)
yield map as row
MERGE (c:Company {name: coalesce(ltrim(rtrim(toString(row.Company
))), "UKNOWN")})
ON CREATE
SET
c.created = datetime()
ON MATCH
SET c.lastUpdated = datetime()
MERGE (p:Product {name:row.Product
+ ' ' + row.Version
})
ON CREATE
SET
p.created = datetime(),
p.Product = row.`Product`,
p.Version = row.`Version
ON MATCH
FOREACH (y in CASE when row.`Version` <> p.Version THEN [1] ELSE [] END | SET p.Version = row.`Version`, p.name = row.`Product` + ' ' + row.`Version`)
RETURN p