Doubt about clause: SET-CASE-WHEN-THEN

Hi. Recently i've posted a query(then solved) that was to sum string values, and if a label was upper that value it was returned like some kind of fraudulent entity.
Here's my query:

Match (e1:ENTIDADE) -[c:CONTRATO]->(e2:ENTIDADE)
With e1, sum(tofloat(replace(replace(C.Preco,".",""),",","."))) as sumPreco
Where sumPreco >50000
Return e1 as Entity, sumPreco

Now, i want to do the same query but instead use the set clause. I've made this way:

Match (e1:ENTIDADE)-[C:Contrato]->(e2:ENTIDADE)
WITH e1, sum(tofloat(replace(replace(C.Preco,".",""),",","."))) as sumPreco
SET(
CASE
WHEN sumPreco >50000
THEN RETURN e1 as FraudulentEntity, sumPreco

but it gives me this error:


Why? The clause's contruction is bad?
Thank you all and stay safe

Hello,

Your syntax is not good: https://neo4j.com/docs/cypher-manual/current/clauses/set/#set-set-a-property
What do you want to SET and what do you want to return?

I've solved it.
This was the solution:

Match (eante:EntAdjudicante)-[C:CONTRATO]->(eataria:EntAdjudicataria)
WITH eante,sum(tofloat(replace(replace(C.Preco,".",""),",","."))) as sumPreco
WHERE sumPreco >50000
REMOVE eante:EntAdjudicante
SET eante:FraudulentEntity
RETURN eante

Thanks anyway

1 Like

Good job:)

No problem