i++

Increment

Generate incrementing numbers (i++)

Overview

The Increment utility generates incrementing numbers like i++ in programming. This is useful for generating page numbers in API calls, creating array indices, or any scenario where you need a counter that increments each time it's executed.

The counter persists its value between iterations within the same flow execution, making it perfect for use inside loops and iterators.

Configuration

Variable Name

The name of the output variable. This will be the key in the output object.

i

Common names: i,page,index,counter

Initial Value

The starting number for the counter. Default is 1.

1

Step

How much to increment by each time. Default is 1.

1

Use negative values to decrement (e.g., -1 for countdown).

Output

The output is a simple object with your variable name as the key:

// With variableName: "i"
{ i: 1 }

// With variableName: "page"
{ page: 1 }

// With variableName: "index"
{ index: 1 }

Access the value in subsequent nodes using: {{#N.i}} or {{#N.page}}

Examples

Example 1: Page Numbers for API Pagination

Fetch multiple pages from an API:

Variable Name:page
Initial Value:1
Step:1
[Loop] ──▶ [Increment] ──▶ [HTTP Request: /api?page={{#2.page}}]
              │
              ▼
         Execution 1: { page: 1 }
         Execution 2: { page: 2 }
         Execution 3: { page: 3 }

Example 2: Array Index for Mapping

Generate indices for items in an iterator:

Variable Name:index
Initial Value:0
Step:1

Indices: 0, 1, 2, 3... (starting from 0 for zero-indexed arrays)

Example 3: Custom Step Value

Skip numbers or countdown:

Skip by 10:

Initial: 0, Step: 10 → 0, 10, 20, 30...

Countdown:

Initial: 10, Step: -1 → 10, 9, 8, 7...

Tips

Tip: The counter resets when the flow execution completes. Each new execution starts fresh from the initial value.

Tip: In nested iterators, the counter increments within the innermost iterator and resets when the outer iterator moves to the next item.

Note: Both initial value and step support dynamic templates:{{#1.data.startPage}}

Increment Utility - Flows Guide - Serenities