Function sum()
sums up a column of numbers, or concatenates a column of string. Only one row from the data stream will be kept after this function is called, and all the rest rows will be abandoned.
Arguments:
- Number or string <number | string>, auto-abstraction: UUID of NODE/EDGE, row index (starting from 0) of PATH/TABLE, or the first element of ARRAY
Returns:
- Sum or new string <number | string>
ATTR (Numeric value)
Example: find the outbound 1-step transfer paths from Card CA001, return the sum of the transfer amounts
n({_id == "CA001"}).re({@transfer} as pay).n({@card})
return sum(pay.amount)
ATTR (String)
Example: find the outbound 1-step transfer paths from Card CA001, return the strings converted from payee cards' IDs
n({_id == "CA001"}).re({@transfer}).n({@card} as payee)
return sum(payee._id)