Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
07-07-2020 12:32 AM
Hello, everyone,
I am new and am currently dismantling equipment parts lists in Neo4j. Now I have encountered a problem. I can already find the path between a device and the component of the last level. I am getting a list >Relationship>. Now I want to multiply all quantities along the path, which are stored in the relation. How does the Cypher Query look like?
(A)-[:HAS [qty:5]]->(B)-[:HAS [qty:2]]->(C)
So I'd like...
A | 10 | C
Thanks for an answer 🙂
Greetings
Julian
Solved! Go to Solution.
07-07-2020 01:43 AM
Hello @julian-hartmann and welcome to the Neo4j community
Did you have a look at relationships()
?
Example:
MATCH p=(A)-[:HAS1..*]->(B)
RETURN reduce(res = 1, r IN relationships(p) | res * r.qty)
Links:
Regards,
Cobra
07-07-2020 01:43 AM
Hello @julian-hartmann and welcome to the Neo4j community
Did you have a look at relationships()
?
Example:
MATCH p=(A)-[:HAS1..*]->(B)
RETURN reduce(res = 1, r IN relationships(p) | res * r.qty)
Links:
Regards,
Cobra
07-07-2020 01:51 AM
Hi Cobra,
thanks a lot 🙂 Yeah, I'll take another look at it, though.
Greetings,
Julian
All the sessions of the conference are now available online