Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
05-19-2020 07:54 AM
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:
Solved! Go to Solution.
05-19-2020 09:21 AM
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
05-19-2020 07:59 AM
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?
05-19-2020 09:21 AM
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
05-19-2020 09:40 AM
Good job:)
No problem
All the sessions of the conference are now available online