Portal Community

Example 1: Filter — Skip Inactive Customers

A monthly statement generation loop processes all customers. Customers without active subscriptions are skipped — no statement is generated and no email is sent.

// Loop: items = "allCustomers"
// Body:
// → IfCondition: "$var.current_item.subscriptionStatus !== 'active'"
//   true:
//     → SetVariable: skippedCount = $var.skippedCount + 1
//     → Continue
//   false:
//     → GenerateStatement
//     → SendStatementEmail

// Done port:
// → SendBatchSummary (uses processedCount and skippedCount variables)

Expected outcome: Only active customers receive statements. Inactive customers are silently skipped with their count tracked. The batch summary reports both figures to the billing team.

Example 2: Idempotent Processing — Skip Already Migrated Records

A data migration loop can be safely re-run. Records already migrated in a previous run are skipped via Continue, preventing duplicate writes.

// Loop: items = "legacyRecords"
// Body:
// → CheckMigrationStatus (HTTP call: GET /migration/status/$var.current_item.id)
// → IfCondition: "$output.CheckMigrationStatus.alreadyMigrated === true"
//   true:
//     → Continue  (skip — already migrated)
//   false:
//     → MigrateRecord (HTTP call: POST /migration/records)
//     → SetVariable: migratedCount = $var.migratedCount + 1

// Done port:
// → LogMigrationResult (reports migratedCount out of loop_total_items)

Expected outcome: Re-running the migration skips all previously migrated records and only processes new ones. The loop is fully idempotent — safe to run multiple times without duplicate data.

Example 3: Skip Null or Malformed Items

An external API returns an array that may contain null entries or objects missing required fields. Guard the loop body with a null check before any processing.

// Loop: items = "apiResults"
// Body:
// → IfCondition: "$var.current_item == null || $var.current_item.id == null"
//   true:
//     → SetVariable: nullCount = $var.nullCount + 1
//     → Continue
//   false:
//     → EnrichRecord
//     → SaveToDatabase

// Done port:
// → If nullCount > 0 → SendDataQualityAlert
// → AlwaysRun: → FinaliseImport

Expected outcome: Null or incomplete records are skipped and counted. Valid records are enriched and saved. After the loop, a data quality alert is sent if any nulls were detected, but the import itself completes successfully regardless.

Example 4: Resilient Batch — Continue on API Error

A bulk enrichment workflow calls a third-party data service for each record. Transient API errors for individual records are caught and the loop continues rather than aborting the entire batch.

// Loop: items = "recordsToEnrich"
// Body:
// → CallEnrichmentAPI (HTTP node, may return error status)
// → IfCondition: "$output.CallEnrichmentAPI.statusCode !== 200"
//   true:
//     → SetVariable: failedIds = $var.failedIds.concat([$var.current_item.id])
//     → Continue  (log and skip, do not abort batch)
//   false:
//     → MergeEnrichedData
//     → SaveRecord

// Done port:
// → If failedIds.length > 0 → ScheduleRetryJob
// → SendBatchCompletionReport

Expected outcome: The batch processes as many records as possible. Failed API calls don't abort the loop — they are collected into failedIds. After the loop, a retry job is scheduled for the failed IDs while the successfully enriched records are already saved.

Example 5: Combine Continue and Break in the Same Loop

A prioritised task processor skips low-priority tasks but immediately stops when a critical-priority task is found (to handle it out-of-band).

// Loop: items = "taskQueue"
// Body:
// → IfCondition: "$var.current_item.priority === 'critical'"
//   true:
//     → SetVariable: criticalTask = $var.current_item
//     → Break  (exit loop, handle critical task immediately)
//   false:
//     → IfCondition: "$var.current_item.priority === 'low'"
//       true:  → Continue (skip low priority for now)
//       false: → ProcessNormalTask

// Done port:
// → If criticalTask != null → EscalateCriticalTask
// → Else: → ReportNormalTasksProcessed

Expected outcome: Low-priority tasks are skipped, normal tasks are processed. If a critical task is encountered, the loop exits immediately via Break and the critical task is escalated. Both Continue and Break coexist cleanly in the same loop body.