Sum Grouping of Values from Array of Item
  • 12 Mar 2021
  • 1 Minute to read
  • Dark
    Light

Sum Grouping of Values from Array of Item

  • Dark
    Light

Article summary

Example Lab Article
While Example Lab projects are resources for public use, articles and assets are not actively maintained. Screenshots and features are from the specified version below. These references may become dated as new versions are released.


Overview

Example Lab Details

Version6.10.1
Root FolderExample Lab - Sum Grouping of Values from Array of Items
Modules None
DependenciesNone

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.

Reference Articles



Project Download

The examples attached were developed to be instructional and were not developed as officially supported components. For more information or to engage our service team to develop fully supported, production quality solutions, please contact services@decisions.com. Import the project below to a Decisions environment on version 6.10.1 or later using our Importing/Exporting article.





Was this article helpful?