How to retrieve a restricted number of objects in a list

0
For an userstory I'm currently working on, I would like to retrieve the last 5 orders a customer has placed, and calculate the average total order value of them.  I've been puzzeling myself on how to do this, but can't come up with the solution. What would be a good way to accomplish this?
asked
1 answers
2

Hi Bart,

  The way to do this is use the Retrieve action.  Under the Options section, there is a 'Range' radio button that you can select to 'Custom.'  You can set your Limit to be 5 to get only 5 results.  To make sure you get the last 5 orders, you can use the 'Sorting' options.  Select the order date and then sort it by descending to get the most recent on top.  This will give you the list of the 5 most recent orders.

  Then use the aggregate list microflow action to sum up the order cost for your 5 objects.  Then simply divide that decimal by 5.

answered