I have 2 nodes employees and contractors. I get a name either with id or not. If I get the id then match on id and if not match on name. First match is against employees followed by contractor. If I do not get a match then do a fuzy match with the name first for employee node and then contractor node.
WITH row WHERE row.CREATED_BY <> 'None' CALL apoc.when(row.CREATED_BY_NTID IS NOT NULL, "MATCH (p:Employee {name: row.CREATED_BY}) WHERE p.account ENDS WITH row.CREATED_BY_NTID return p", "MATCH (p:Employee {name: row.CREATED_BY}) return p", {row:row}) yield value With row, value.p as p IF value.p IS null CALL apoc.when(row.CREATED_BY_NTID IS NOT NULL, "MATCH (p:Contractor {name: row.CREATED_BY}) WHERE p.account ENDS WITH row.CREATED_BY_NTID return p", "MATCH (p:Contractor {name: row.CREATED_BY}) return p", {row:row}) yield value With row, value.p as p IF value.p IS null match (p:Employee) where p.name starts with 'XXXXXXX' return p -- You received this message because you are subscribed to the Google Groups "Neo4j" group. To unsubscribe from this group and stop receiving emails from it, send an email to neo4j+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/neo4j/6318ef6b-465b-46e3-beb4-d638eeec6982n%40googlegroups.com.