Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
12-21-2020 02:48 AM
Hi
can I use param for label and/or type?
:param NodeLabel => 'person';
:param RelType => 'has_mail';
MATCH (n1:$NodeLabel)-[r:$RelType]->(n2) RETURN r, n1, n2;
in the browser I get an error :
Neo.ClientError.Statement.SyntaxError: Invalid input '$': expected whitespace or a label name (line 1, column 11 (offset: 10))
"MATCH (n1:$NodeLabel)-[r:$RelType]->(n2) RETURN r, n1, n2"
Is there are trick?
thanks rob
Solved! Go to Solution.
12-21-2020 01:16 PM
Hello @rob2
It is not possible to use a Label or a Type as a parameter in a MATCH clause.
Regards,
Cobra
12-21-2020 01:16 PM
Hello @rob2
It is not possible to use a Label or a Type as a parameter in a MATCH clause.
Regards,
Cobra
12-21-2020 08:49 PM
Thanks - also not in a where statement i guess ... rob
12-22-2020 12:55 AM
Sorry, it's not possible in a MATCH clause but there is a workaround for WHERE clauses:
MATCH (n1)-[r]->(n2)
WHERE $NodeLabel IN LABELS(n1) AND type(r) = $RelType
RETURN r, n1, n2;
Regards,
Cobra
12-22-2020 06:29 AM
merci I will give it a try!
All the sessions of the conference are now available online