- 12 Mar 2021
- 1 Minute to read
- Print
- DarkLight
Sum Grouping of Values from Array of Item
- Updated on 12 Mar 2021
- 1 Minute to read
- Print
- DarkLight
Overview
Example Lab Details | |
Version | 6.10.1 |
Root Folder | Example Lab - Sum Grouping of Values from Array of Items |
Modules | None |
Dependencies | None |
This Example Lab demonstrates how to group dynamic object items with the same value on a field called "Code", and then loop for each of those groupings in order to Sum the values from the list of the other field called "Value".
Explanation
This Flow works by taking in a list of objects called Test Example with an Int32 value and a String value. The For-Each step groups the items by "Code" and then loops through the groups that are made. The Flow is set up to pass all of the values in the Sum Values in Each Group step while going through the new list grouping; this occurs so the Flow can sum the list of values from the current grouping of "Code" in order to get the main value for all items that have the same "Code". The Flow then adds a new item with the new sum of values to a list that can be passed to the new list (of each "Code" type, including related values) as an output array. View the output array (from running the unit test) to see that the list only contains one item for each "Code" grouping with the sum value of all original Items.