Calculate sum 0 to 100 iteratively every 5 minutes

Recipe ToolsMarketing

What it does

When the Clock triggers every 5 minutes, this automation initializes a variable and loops through a list to sum numbers from 0 to 100. Each iteration updates the total and logs the result to the job report.

Who it's for

Engineering teams who need to test iterative calculations and logging in a controlled environment.

How teams use this

Test iterative sum logic in automation

Verify that the automation correctly sums numbers from 0 to 100 on each 5-minute cycle. The job report shows every intermediate total so the calculation can be audited.

Measure loop performance over time

Run the automation repeatedly to measure how long each iteration takes and whether the variable updates consistently. Logs provide visibility into each step of the loop.

Extend to sum a custom number range

Modify the repeat helper list to sum a different range of numbers, such as 1 to 50 or 0 to 200. Only the list values need to change for the loop to work with new data.

Add conditional logging for key milestones

Include a condition in the loop so the job report only logs when total_sum reaches certain milestones, such as every 500 or 1000. This reduces log volume while keeping key checkpoints visible.

How it works

  1. Run on a 5-minute schedule. The Clock triggers every 5 minutes to start the sum calculation process.
  2. Set total sum variable to zero. Create a variable named total_sum and initialize it to zero before the loop begins iterating through the numbers.
  3. Loop through numbers and update total. For each number in the repeat helper list from 0 to 100, add it to total_sum and log the running total to the job report after each iteration.