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.