Hi,
I am trying to use "apoc.do.when" function, and I am probably doing something wrong.
Basically, We are trying to copy labels from one node to a group of nodes that meet a certain condition.
I want to run the SET command only if I found missing labels and I tried to do something like that:
MATCH(A:<label> {name:<name>})
MATCH(B:<label> {name:<name>})
CREATE(A)-[w0:data]->(B)
WITH A, B, labels(A) as labelsA, labels(B) as labelsB WITH A, B, [uniqlabelsB in labelsB where not (uniqlabelsB in labelsA) and uniqlabelsB STARTS WITH 'group' | uniqlabelsB] as missingLabelsFromNode1, [uniqlabelsA in labelsA where not (uniqlabelsA in labelsB) and uniqlabelsA STARTS WITH 'group' | uniqlabelsA] as missingLabelsFromNode2
CALL apoc.do.when(size(missingLabelsFromNode1) > 0,"MATCH(FA) where FA.family_name STARTS WITH A.family_name set FA:B.base_group", "", {A:A, B:B}) YIELD value
RETURN A,B
And I got this error message neo4j.exceptions.ClientError: Failed to invoke procedure
apoc.do.when: Caused by: org.neo4j.exceptions.SyntaxException: Invalid input '.'
What am I doing wrong?
How can I get the base_group parameter from the B node and set it as a label for all the FA nodes?
I also tried to use the missingLabelsFromNode1 variable but it ignores from this parameter also.
Thanks in advance.
Dan