Xpath.Java: How do I aggregate (sum) the values of a list?

I’m using the CommunityCommons-ObjectHandling Xpath.Java helper class to extend our application. I’m implementing dynamic-built Xpath retrieves via Java, to improve performance (currently 20 seconds → 400ms), but I ran into unexplored terrain: How do I do a simple sum of all values of a specific attribute from a list (i.e. aggregate sum of ‘OpenAmount’ of ‘List X’)? Doing a Xpath retrieve or count is no issue, but I scrolled through the xpath.java library and I saw nothing that could help me do a sum of all values (i.e. Sum of PaidAmount of all Orders)? Because of pagination, I require to retrieve all objects and sum some values. But that’d mean retrieving 100.000s of objects. When the retrieve and aggregation is both done directly in the microflow, this has no performance impact. However, I’m retrieving by Java and that would separate the aggregation, resulting in performance loss. Hence, my request to perform the sum in Java as well. Who has used the Community Commons Xpath.Java library and could help me out?    
0 answers