Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
08-03-2020 11:36 PM
While calling through the following query in neo4jBrowser
call apoc.cypher.runFile("toolQuery.cyp",{parameters: {transitionType: 'SERVICEDESK'}})
There were no response no record and no changes exist. But without parameter , its working as expected.
Note: - toolQuery.cyp has contain my cypher query details. here is the parameter query am passing MATCH p=(n)-[r:$transitionType]->(m).
kindly go through is there any mistake i did.
08-04-2020 12:11 AM
Hello @mr.gsk0509 and welcome to the Neo4j community
You can't set a relationship type or a label from a parameter
Regards,
Cobra
08-04-2020 12:39 AM
Thank you. Is there any another way of achieve this?
08-04-2020 03:38 AM
While you can't use parameters as labels directly, you can use CALL apoc.create.addLabels( [node,id,ids,nodes], ['Label',…])
to apply labels based on an array of values, and those array of values can come from parameters.
Example - this won't work:
MATCH (n) where id(n) = 3
SET n:$LabelParameter
RETURN n
This should work:
CALL apoc.create.addLabels([3], [$LabelParameter]);
08-04-2020 12:40 AM
What are you trying to achieve with your Cypher file?
08-04-2020 01:43 AM
Dynamic relationship data will change from my frontend. so, I have to pass the parameter in this cypher query.But this below syntax didn't work in neo browser ,
call apoc.cypher.runFile("toolQuery.cyp",{parameters: {transitionType: 'xxx'}})
transitionType would be xxx, yyy or zzz ..
08-04-2020 01:46 AM
You want to create relationships?
08-04-2020 01:52 AM
No. Node,labels and relationships are already created in neo4j db.
Only need to call apoc.cypher.runFile("toolQuery.cyp",{parameters: {transitionType: 'xxx'}})
with following param of either xxx, yyy or zzz.
dynamically cypher query should accept the either of this value.
MATCH p=(n)-[r:$transitionType]->(m)
08-04-2020 02:47 AM
Try:
MATCH p=(n)-[r]->(m) WHERE type(r) = $transitionType
08-04-2020 03:36 AM
Tried its working cobra. Thank you very much.
All the sessions of the conference are now available online