Skip to main content
All CollectionsTemplatesBasic
Simple Loops with Torq - Workflow Template
Simple Loops with Torq - Workflow Template

Example of using a loop over JSON data and loop over a range in a workflow. Results are collected with the "Collect" operator

Updated over a week ago

This Torq workflow template enables concurrent processing of JSON data and range-based operations in an efficient manner. It adds a JSON object to the workflow context, then simultaneously runs two loops in parallel. The right branch processes a list of JSON entities, classifying engine names based on their verdicts into separate arrays. Meanwhile, the left branch iterates from 1 to 10, pausing for 2 seconds after each round and accumulating text messages about the loop progression. Ideal for scenarios requiring parallel data analysis and time-managed tasks.

Use Cases

null

Workflow Breakdown

  1. Add a JSON object to the workflow context.

  2. Runs two different loops in parallel threads.

  3. Right branch loops over a list of JSON items, and creates a separate list of engine names by verdict.

  4. Left branch loops over a defined range from 1 to 10. Collects a text message about the loop count and wait 2 seconds before continuing the loop.

Vendors

Utils

Workflow Output

Simple output of each loop that is run

Tips

Review the output of the loop over JSON data and the collector contents.","Review the output of the loop over range. Modify the if step for the loop to break earlier or later in the loop

Did this answer your question?