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,
Ronald
[EDIT]
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.