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:

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
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


Your syntax is not good: SET - Cypher Manual
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