Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
07-10-2021 08:11 PM
Dear Community. I have 2 cyphers which - on the surface - appear to be identical except for the property they are setting. The first one works as it should; the second "clone" does not. Could you have a look:
Query 1. Goal is to add the root PROG node (t) to all its descendents to level 20
MATCH (t:PROG {isJob: true})
CALL apoc.path.subgraphNodes(t, {
relationshipFilter: "USES>",
minLevel: 1,
maxLevel: 20
}) yield node
WITH node, collect(t.label) as jl
SET node.inUse = true, node.hasJobList = true, node.jobList = jl;
works perfectly
Query 2: same thing - except that the root node is a "TRAN"
MATCH (t:TRAN)
WITH t
WHERE t.label <> "JOB"
CALL apoc.path.subgraphNodes(t, {
relationshipFilter: "USES>",
minLevel: 1,
maxLevel: 20
}) yield node
WITH t, node, collect(t.label) as tcl
SET node.inUse = t.inUse, node.hasTcodeList = true, node.tCodeList = tcl;
Only seems to store the last value in tCodeList instead of a collection. I think that the answer is probably right in front of me - but it is eluding me, Any help would be much appreciated. P.S. if there is a better way to cash the root of the tree, I would love to know.
07-11-2021 03:16 PM
Because you have t as an aggregation key so you get one row aggregated per t and node.
Remove the t as agg key and you get all t‘s for the node aggregated
07-12-2021 10:57 AM
I feel SOOO stupid. Thanks!!!
All the sessions of the conference are now available online