Show Entity summary

Hi there, I’m trying to obtain some statistics from my entity database. Assume I have a database, where I store orders of a store, with for every order, the date, and the city of the customer who made the purchase. I then want to have a field where I can show the city in which most customers live, and on which day I had the most customers visiting my store. This would require me to make new lists, where I can store the counts of cities and dates respectively. I have been trying to achieve this for a while now, but without succes. Any help is much appreciated!   EDIT: In case of the cities: The city is entered manually when adding a purchase, there is no set list of cities. So I would first like to retrieve a list of all unique cities in my database, over which I then can iterate, to obtain the counts of every city in the database. I’m having trouble to retrieve this list of unique cities.
2 answers

Create a new entity where you can store the unique cities. Then iterate over your orders that do not have a reference to this entity. In the iterations retrieve that new entity by the city name of the order. If found set a reference to that new object. If not found create that new object and then set the reference. Once done you can view that new entity and see all the orders attached to this. Advantage is that now you can start normalize your database by changing the city in the orders. You could even create an extra entity with the textstrings of that city name match that same city. And in the end you might even use an on change action where the person entered the city you could make suggestions on city names.


Good luck,



Create a datagrid where you show this new entity and create a button proces orders. Then in the microflow do something like this:

The XPath to use on the order retrieve:

And this for the subflow



Thanks for the extensive reply! I'll surely check it out next week to see whether this works.
I have implemented it another way.

I created a microflow which both commits the order and obtains the city object from the order, which it then places in a city entity allong with the count.
This way I can just retrieve the city entity, which contains a list of all cities and their occurences.
This way I cannot see which order belongs to which city, but this is stored in the order entity anyway.