Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
07-29-2020 03:27 AM
Using
Neo4j 4.0.3
APOC apoc-4.0.0.17-all.jar
Neo4j Browser version: 4.0.5
As part of an analysis process I get 5 (dirty) collections mixed with numbers, text ans NULLs. I'd like to find the maximum number over all 5 collections. Therefore I did something like
<RETURN apoc.coll.max([0]++[1,2,3,4,5,6]+[7,0]+["ABC"]+) > ==> 7 (fine)
Unfortunately some of the collections have NULL values
<return apoc.coll.max([NULL]+[NULL]+[NULL]+[0,1,2]) > ==> 2 (fine)
<return apoc.coll.max([0,1,2]+[NULL])> ==> 2 (fine)
But
<return apoc.coll.max([NULL]+[NULL]+[NULL]+[0,1,2]+[NULL]) > ==> NULL
afterwords executing again
<return apoc.coll.max([0,1,2]) > ==> NULL
The only chance to get rid of this NULL is to restart the database
Additional to this:
<apoc.coll.max([""]++[1,2,3,4,5,6]+[7,0]+["ABC"]+)> ==> "ABC"
I would like to have the control, that the apoc.coll.max evaluates only numeric values and not occasionally text.
07-29-2020 05:10 AM
Hello @klaus.bermuth
You could use a comprehension list with a CASE to clean your list to make sure to have only integers
Regards,
Cobra
07-29-2020 06:09 AM
Hey,
There's a bug in versions before 4.0.4 with respect to how apoc.coll.min
and apoc.coll.max
work. If you bump your Neo4j version that should sort it out.
See the note on the APOC releases page about this issue - https://github.com/neo4j-contrib/neo4j-apoc-procedures/releases/tag/4.0.0.11
All the sessions of the conference are now available online