Modify value in Bloom Search

Hi,

I have a Bloom query that is generally working, but not quite. The target property is used to modify the display property of nodes in the Bloom display. A value of 1 color codes the node to the target company and 0 is meant for other companies. However sometimes other company is actually the same as

The problem with the code here is that if (c:company) is the same as (A:company) I would like the b.target set to 1.

Match p=(A:company{name:$target})<-[:Assigned_to]-(t:patent)<-[:Cites]-(b:patent)-[:Assigned_to]->(c:company)
set t.target =1
set b.target = 0
Return p

I am trying to use the apoc.do.when as a solution:

Match p=(A:company{name:$target})<-[:Assigned_to]-(t:patent)<-[:Cites]-(b:patent)-[:Assigned_to]->(c:company)
set t.target =1
with p,b,c
Call apoc.do.when(c.name=$target,
'Set b.target=1',
'Set b.target=0') Yield value
Return p

But I am getting an error regarding not recognizing the b variable.

Alternative solutions?
Andy

You need to pass {b:b} as parameters to do.when

but easier to just do: set b.target = case when c.name=$target then 1 else 0 end