Counter
Description
Section titled “Description”This module increments by 1 the value of the contador field in the flow data. If the contador field does not exist or is not a valid number, it is initialized to 0 before incrementing. It is a simple utility module that can be used as part of loops in workflows to count iterations, control retry limits, or keep a count of processed elements.
Configuration
Section titled “Configuration”Parameters
Section titled “Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
| contador | string | No | Initial counter value (defined in the scheme). Default "1". |
Output
Section titled “Output”{ "nextModule": "siguiente_modulo", "data": { "contador": 2, "otros_campos": "se preservan" }}Usage Example
Section titled “Usage Example”Basic case
Section titled “Basic case”{ "contador": "1"}With input data:
{ "contador": 5, "nombre": "proceso_batch"}Result: { "contador": 6, "nombre": "proceso_batch" }
- The increment is always +1
- If
contadoris not a valid number (NaN), it is reset to 0 before incrementing - A copy of the data object is created to avoid undesired mutations
- All other fields of the input object are preserved in the output
Related Nodes
Section titled “Related Nodes”- evaluateExpression (for more complex mathematical operations)
- dataset (for building data with calculated values)
- iterador (use counter to control iterations)