Skip to main content

Collection Functions

Functions for aggregate operations on lists and collections.

Collection Count​

Counts the number of items in a collection.

PropertyValue
CategoryCollection Utilities
Min Arguments1
Returnsinteger

Arguments:

#NameTypeDescription
0Collectionlist of integer, float, decimal, moneyCollection to count

Example:

Collection Count(LineItems) → number of line items
Collection Count(Participants) → number of participants
Collection Count(Errors) → number of errors found

Collection Sum​

Returns the sum of all elements in a numeric collection.

PropertyValue
CategoryCollection Utilities
Min Arguments1
ReturnsHighest weight numeric type

Arguments:

#NameTypeDescription
0Collectionlist of integer, float, decimal, moneyCollection to sum

Example:

Collection Sum(LineItemTotals) → order total
Collection Sum(Scores) → total score
Collection Sum(Payments) → total payments received

Collection Average​

Returns the average of all elements in a numeric collection.

PropertyValue
CategoryCollection Utilities
Min Arguments1
ReturnsHighest weight numeric type

Arguments:

#NameTypeDescription
0Collectionlist of integer, float, decimal, moneyCollection to average

Example:

Collection Average(TestScores) → average score
Collection Average(Ratings) → average rating
Collection Average(ResponseTimes) → average response time

Collection Maximum​

Returns the highest value in a collection.

PropertyValue
CategoryCollection Utilities
Min Arguments1
ReturnsHighest weight numeric type

Arguments:

#NameTypeDescription
0Collectionlist of integer, float, decimal, moneyCollection to search

Example:

Collection Maximum(Prices) → highest price
Collection Maximum(Bids) → winning bid
Collection Maximum(Temperatures) → peak temperature

Collection Minimum​

Returns the lowest value in a collection.

PropertyValue
CategoryCollection Utilities
Min Arguments1
ReturnsHighest weight numeric type

Arguments:

#NameTypeDescription
0Collectionlist of integer, float, decimal, moneyCollection to search

Example:

Collection Minimum(Prices) → lowest price
Collection Minimum(StockLevels) → minimum stock level
Collection Minimum(Scores) → lowest score

Projection​

Transforms each item in a collection into a new value.

PropertyValue
CategoryCollection Utilities
Min Arguments2
Returnslist (of the selector's result type)

Arguments:

#NameTypeDescription
0CollectionlistSource collection to project
1Selectorany expressionExpression evaluated for each element to produce the new value

Description: Projects each element of a collection to a new form, returning a new collection of the results (a map/select operation). Each element is exposed to the selector through a configurable element variable, and its position within the collection is available through that element's .Index.

Example:

Projection(LineItems, Multiply(Item.Quantity, Item.UnitPrice)) → collection of line totals
Projection(Contacts, Concatenate(Item.FirstName, " ", Item.LastName)) → collection of full names

Filter​

Selects the items in a collection that satisfy a condition.

PropertyValue
CategoryCollection Utilities
Min Arguments2
Returnslist (same type as the source collection)

Arguments:

#NameTypeDescription
0CollectionlistSource collection to filter
1ConditionbooleanBoolean expression evaluated for each element; elements that evaluate to true are kept

Description: Filters a collection, returning a new collection containing only the elements for which the condition evaluates to true. Each element is exposed to the condition through a configurable element variable.

Example:

Filter(Orders, Is Greater Than(Item.Amount, 1000)) → orders over 1,000
Filter(Contacts, Not Null Or Empty String(Item.Email)) → contacts that have an email

Collection Functions Quick Reference​

FunctionReturnsUse Case
Collection CountintegerHow many items in the list
Collection SumnumericTotal of all values
Collection AveragenumericMean of all values
Collection MaximumnumericHighest value
Collection MinimumnumericLowest value
ProjectionlistTransform each item into a new value
FilterlistKeep only items that match a condition

Common Patterns​

Order Total Calculation:

Collection Sum(LineItemAmounts)

Checking if Collection Has Items:

Is Greater Than(Collection Count(Items), 0)
// Or simply use: Any(Items)

Average with Minimum Check:

If Condition(
Is Greater Than(Collection Count(Scores), 0),
Collection Average(Scores),
0
)

Range Validation:

And(
Is Greater Than Or Equal To(Collection Minimum(Values), MinAllowed),
Is Less Than Or Equal To(Collection Maximum(Values), MaxAllowed)
)

Statistical Summary:

Format("Count: {0}, Sum: {1}, Avg: {2}, Min: {3}, Max: {4}",
Collection Count(Values),
Collection Sum(Values),
Collection Average(Values),
Collection Minimum(Values),
Collection Maximum(Values)
)