Count the number of items that have the same name.

How to count items that have the same name and display it in a data grid by associating the "item" column with the "Quantity" column? I've checked the documentation, but it's not clear.
1 answers

Hi Heverton,


If you have an entity Item and an attribute Name, you want to count the number of occurrences of Item.Names. Further, you want to display them in a grid where the first column is Item.Name and the second one the number of occurrences of that Item.Name.


The strategy to choose is depending on the number of views of that grid and the number of writes to Item. If the number of displays in the grid using a microflow is high, and the number of writes to Item is low, I would choose a calculated attribute, for example, named Total, in Item that counts the number of identical Names when committing the Item. If there are many writes and a low number of views, I would go for a Microflow as the data source for the grid.


The calculated attribute Total can be created by retrieving all Item and filter to on Name by using the List operation Action. The filtered list can be counted by using an Aggregate list Action. This value is the return type of the Microflow of the calculated attribute to populate Item.Total.


The same strategy can be used when using a Micfoflow as source. Retrieve the list, loop over Name and use the same as above.


Go make it.