Collection Functions
Functions for aggregate operations on lists and collections.
Collection Count
Counts the number of items in a collection.
| Property | Value |
|---|---|
| Category | Collection Utilities |
| Min Arguments | 1 |
| Returns | integer |
Arguments:
| # | Name | Type | Description |
|---|---|---|---|
| 0 | Collection | list of integer, float, decimal, money | Collection 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.
| Property | Value |
|---|---|
| Category | Collection Utilities |
| Min Arguments | 1 |
| Returns | Highest weight numeric type |
Arguments:
| # | Name | Type | Description |
|---|---|---|---|
| 0 | Collection | list of integer, float, decimal, money | Collection 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.
| Property | Value |
|---|---|
| Category | Collection Utilities |
| Min Arguments | 1 |
| Returns | Highest weight numeric type |
Arguments:
| # | Name | Type | Description |
|---|---|---|---|
| 0 | Collection | list of integer, float, decimal, money | Collection 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.
| Property | Value |
|---|---|
| Category | Collection Utilities |
| Min Arguments | 1 |
| Returns | Highest weight numeric type |
Arguments:
| # | Name | Type | Description |
|---|---|---|---|
| 0 | Collection | list of integer, float, decimal, money | Collection 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.
| Property | Value |
|---|---|
| Category | Collection Utilities |
| Min Arguments | 1 |
| Returns | Highest weight numeric type |
Arguments:
| # | Name | Type | Description |
|---|---|---|---|
| 0 | Collection | list of integer, float, decimal, money | Collection to search |
Example:
Collection Minimum(Prices) → lowest price
Collection Minimum(StockLevels) → minimum stock level
Collection Minimum(Scores) → lowest score
Collection Functions Quick Reference
| Function | Returns | Use Case |
|---|---|---|
| Collection Count | integer | How many items in the list |
| Collection Sum | numeric | Total of all values |
| Collection Average | numeric | Mean of all values |
| Collection Maximum | numeric | Highest value |
| Collection Minimum | numeric | Lowest value |
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)
)