Flow Tutorial

This page demonstrates the basics of working with flows. It uses a simple, self-contained algorithm to illustrate how to add, configure, and connect instruction blocks in the workspace, serving as an introduction to flow creation.

Algorithm:

  • Start with a list of numbers: 3, 7, 2, 9

  • Go through each number in the list:

    • If the number is bigger than 5, add 10 to it

    • Otherwise, double it

    • Put the result into the "results" list

  • Write the result to the execution log

Expected result:

This example serves as a simple demonstration of how loops, conditions, operations, and variables can be set up in the Flow editor’s visual environment.

All the customizing is performed in the Flow Editor .

To start, the initial number array needs to be created and stored in the execution context under $.inputArray. For this, a Set Variable block is dragged from the instructions panel into the workspace. Once placed, a data binding is configured to define where in the context the data will be stored and what value it will hold.

Data bindings map a specific JSON path in the execution context to a given value. While they can be used for more complex transformations, in this case a simple integer array will be stored.

A second data binding is then added to initialize an empty array in the execution context. This will serve as the storage location for the processed numbers generated later in the flow. In this case, the source is set to an empty JSON array, and the target is defined as $.outputArray within the context.

Next, a For Each block is added to iterate over each item in the input array. This is done by dragging the instruction from the Loops category into the workspace. In Conigma Connect, instruction blocks that can contain other blocks must be explicitly closed with their matching end block. The End For Each instruction marks where the loop finishes, and together these instruction blocks define the exact scope of the operations that will run for each item.

The For Each instruction is configured by specifying the collection to loop over and defining where the current item should be stored. The collection is sourced from a JSON path, in this case $.inputArray, which was created earlier in the flow. For the output, the current item from the collection is written to a separate JSON path in the context, here set as $.currentNumber, so it can be used in subsequent operations inside the loop.

Inside the loop, an If block is added to evaluate whether the current number meets a specific condition. The condition input is set to evaluate an expression, in this case $.currentNumber > 5. Note that JSON paths can be used directly in expressions. As with other control flow elements, the If block must be closed with an End If block.

For the true case where the current number is greater than five, a Set Variable block is used to add 10 to the value and insert it into the results array. The source is configured to evaluate an expression using $.outputArray.AsArray().Append( $.currentNumber + 10 ). This expression takes the existing array at $.outputArray, appends the new calculated value to it, and returns the updated array as a whole. Note: Conigma Connect provides a number of predefined helper functions for use in expressions, which allow for dynamic data transformations (cf. Data Bindings).

The general concept of a Set Variable block is that the data source must always evaluate to a complete JSON node, while the data target must evaluate to a JSON path in the execution context. Since the target node is entirely replaced during execution, the source needs to represent the full structure that should exist at that path after the operation.

This differs from typical programming assignments like var x = y + z, where the value is updated in place. Instead, the value is fully rebuilt and then written to the specified path, which is conceptually closer to languages that use a syntax such as WRITE y + z INTO x.

The block’s context menu, accessible via the burger icon, provides several functions to manage and reuse instructions within a flow. Options include copying, cutting, pasting before a specific position, deleting, and moving blocks. For convenience during flow creation, the Copy function allows duplicating an existing block with all its settings preserved.

In this example, the previous block is copied and placed into the Else branch, where it is then modified to double $.currentNumber instead.

In the final step, the resulting array containing the modified numbers is written to the flow execution log. This is done using a Log block, where the message is configured to evaluate the JSON path $.outputArray from the flow context, which we modified earlier.

The final flow for the pseudocode example is shown here. Each block can be annotated with an optional custom title, which is especially useful when complex operations are implemented, making it easier for others to understand the logic. The indentation of the blocks visually represents the execution scope in which each block operates, indicating whether it is part of a loop, a conditional branch, or another nested structure.

Before executing, the flow should be saved and validated. The toolbar provides options for saving and checking the syntax, which confirms whether the flow is consistent and free of structural errors.

The current flow is saved using the Save or Save As option. After saving, the Check syntax function is used to perform a static validation of the flow. This verifies that all configured instruction blocks are correctly defined and that their fields meet the required structure, allowing configuration issues to be identified before execution.

The flow can be executed manually from the editor, which also triggers an automatic save of the current state. After execution starts, status messages confirm the action and show the transition to the Running state. When the execution finishes, the final status is reported directly in the flow editor.

Now it is time to review the flow results. Opening the flow executions (checkpoints) lists all previously executed flows. In this case, the search criteria reveals the executions started today in descending order, making it easy to locate the run that was manually triggered earlier.

Opening the execution details provides access to two main areas: the final flow context and the step-by-step execution logs. Additionally, control buttons on the top allow users to refresh the execution state or restart failed flows. The flow context contains all variables and their values, making it possible to review the complete data state at the end of the run. The logs list each executed step in order and can also display any warnings, exceptions, or errors that occurred. In this case, the output from the final log instruction is visible, showing the correct result for the simple example flow.

Opening the context tab displays the complete flow context after execution. In this example flow, the variable $.inputArray was initialized at the start of the flow with the values [3, 7, 2, 9].

During the For Each loop, either the doubled value or the value increased by 10 was appended to $.outputArray, depending on the condition branch. The context view shows both variables as separate JSON arrays, with their correct state at the end of execution.

Congratulations, you have finished your first Conigma Connect flow.