0

Count Sum Items in Collection

  • updated 1 mth ago

Description

The list_count part returns the count, sum, or iterated count of items in a single or multi-dimensional array.

Use

You can use this part to gain insight into the data held in a collection. When you choose the SUM mode, the part cycles through a simple collection of items (1...2....etc.) and presents the sum of those items when the item is numeric. When you choose COUNT or ITERATED COUNT, the system counts the number of items cycled through based on their index (count) or non-indexed (iterative count) nature.

When the count of items in a collection equals zero, this indicates the collection is empty. This can be a useful variable to incorporate into a rule that can be used in directing the pathway (if the collection is not empty, then process items in the collection, otherwise proceed down alternative path). Note that for indexed collections (collection[1].item, collection[2].item....) it is more efficient to just check whether the first item is empty (collection[1].item is not "")

Tips and Tricks

This part should only be used with collections (arrays). If you are working with groups/containers, then use the group calculations part to count items. (See the article here).

Using the DATA tab, you can identify whether your data model is using collections or groups/containers as follows:

[ ] interest_level            [ ] signifies collection
#1 = "football"                #1 signifies first position in the collection
#2 = "golf"                    You can reference the value 'golf' as $(interest_level[2])

{ } interest_level            {  } significies a group or container
        sport = "football"        objects within the group are indented.
                                  You can reference this value as $(interest_level.sport)

Editor Fields

Field Name

Description/Use

Type/Options 

Optional/Mandatory 

Data object

Object name where the returned value will be stored.

Text

Mandatory

Collection

Name of the collection containing the object items to be counted or summed up.

Collection

Mandatory

Mode

Selector allowing the choice of count or sum or iterated count.

Dropdown

Mandatory

Value field

This option only applies to SUM mode. Specify the particular (numeric) dimension in the array to calculate the sum of all values of that dimension.

Text

Optional

Big number calculation

Checking this box enables the part to sum across "big numbers" - those that cannot be represented in 32 bits.

Checkbox

Optional

 

Example

Download and import the following example project in your workspace. This example is the How to Guide for Collections and focuses on sum and count on one of the tabs.

Reply Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
Like Follow
  • 3 yrs agoLast active
  • 48Views
  • 3 Following

Home