Skip to main content

Foreach

The Foreach activity iterates over a collection of dimension members, executing a subprocess for each item independently.

Purpose

Use the Foreach activity to:

  • Process multiple members in a loop
  • Execute the same operations for each element in the collection
  • Handle batch processing scenarios

Foreach Activity Editor

Behavior

Iteration Model

  • Subprocess-Based: Built on the Subprocess activity
  • Independent Instances: Each iteration is treated as a separate subprocess instance
  • Parallel Support: Iterations execute in parallel
  • Collection Processing: Processes items from a dimension query

Structure

Foreach: [Collection]
└─ Subprocess Instance (for each item)
├─ Activity 1
├─ Activity 2
├─ ... ... ...
└─ Activity N

Usage Notes

  • Each iteration has its own execution context
  • The subprocess template is reused for each item
  • Items are processed independently
  • Progress tracking shows status of each iteration

Common Patterns

Multi-Entity Operations

Foreach: Account List
└─ Subprocess: Account Operations
├─ Validate Account
├─ Calculate Balance
└─ Generate Report

Comparison to Manual Loops

ApproachForeach ActivityManual Loop Pattern
SetupBuilt-inRequires custom logic
ClarityClear intentRequires interpretation
MaintenanceEasierMore complex
Error HandlingPer-iterationManual implementation
Progress TrackingAutomaticManual logging

When to Use

  • Processing multiple records or entities
  • When iteration logic is straightforward
  • When you want clear visualization of iteration status
  • When each item requires the same processing steps
  • For batch operations with independent items