apoc.coll.sumLongs
Syntax |
|
||
Description |
Returns the sum of all the |
||
Arguments |
Name |
Type |
Description |
|
|
The list of numbers to create a sum from after each is cast to a java Long value. |
|
Returns |
|
Usage examples
The following examples compute the sum of numeric values in a list, casting them to Long (Cypher integer) values in the process, using both APOC and Cypher:
apoc.coll.sumLongs
WITH [1.5,2.5,3.6,4.3,5.2] AS list
RETURN apoc.coll.sumLongs(list) AS output
Using Cypher’s UNWIND, sum() and toInteger()
WITH [1.5,2.5,3.6,4.3,5.2] AS list
RETURN reduce(sum = 0, x IN toIntegerList(list) | sum + x) AS output
Output |
---|
15 |