Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
03-07-2019 10:51 AM
I need to normalize the math scores that are stored as a property on the node and then update the same property with a normalized value. I have tried this:
MATCH (r:MathScore)
WITH COLLECT(r.score) as myScores
UNWIND myScores as x
WITH myScores, min(x) as n, max(x)-min(x) as den
WITH den, myScores, [val in range(0, size(myScores)-1) | round((myScores[val]-n)*100/den)/100] as g
RETURN g, myScores
The above query gives me the correct results in two lists but I am not able to find a way to update r.score with the values in list g.
Please, can someone help?
Thanks!
03-09-2019 06:11 AM
MATCH (r:MathScore)
WITH COLLECT(r.score) as myScores, min(r.score) as n, max(r.score)-min(r.score) as den, collect(r) as rels
UNWIND rels as r
SET r.score = round((r.score-n)*100/den)/100
RETURN collect(r.score) as g, myScores
All the sessions of the conference are now available online