Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
07-13-2022 07:11 AM
I am trying to set labels dynamically with the `poc.create.setLabels function:
:auto MATCH (n:TempNode)
CALL {
with n
CALL apoc.create.setLabels( n, [ n.type ] ) YIELD node
} IN TRANSACTIONS;
I get a strange error that I never saw before:
Neo.ClientError.Statement.SyntaxError
Variable `n` not defined (line 3, column 10 (offset: 35))
" with n"
^
Any ideas why this fairly simple query does not work?
07-13-2022 10:36 AM
Hi @martin2 !
Really interesting. This is mainly due to the parsing expecting a node Yield call function. I'll check this internally, meanwhile, considering you are changing into a label, removing also the type will make it work.
:auto MATCH (n:TempNode)
CALL {
with n
CALL apoc.create.setLabels( n, [ n.type ] ) YIELD node
remove n.type
} IN TRANSACTIONS;
07-13-2022 07:26 PM
Try this:
:auto
MATCH (n:TempNode)
CALL {
with n
CALL apoc.create.setLabels( n, [ n.type ] ) yield node
return node
} IN TRANSACTIONS
return node
It didn't seem to like the yield without a return.
All the sessions of the conference are now available online