Multiply the quantity stored in a relationship

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

Hello @julian-hartmann and welcome to the Neo4j community :slight_smile:

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

1 Like

Hi Cobra,

thanks a lot :) Yeah, I'll take another look at it, though.

Greetings,
Julian

1 Like