Skip to content

Counter

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.

ParameterTypeRequiredDescription
contadorstringNoInitial counter value (defined in the scheme). Default "1".
{
"nextModule": "siguiente_modulo",
"data": {
"contador": 2,
"otros_campos": "se preservan"
}
}
{
"contador": "1"
}

With input data:

{
"contador": 5,
"nombre": "proceso_batch"
}

Result: { "contador": 6, "nombre": "proceso_batch" }

  • The increment is always +1
  • If contador is 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
  • evaluateExpression (for more complex mathematical operations)
  • dataset (for building data with calculated values)
  • iterador (use counter to control iterations)