Using CODED FLOWS

Control & Variable Bricks

Control Bricks and Variable Bricks are fundamental components in CODED FLOWS, enabling users to design sophisticated, flexible, and reliable flows. Control Bricks manage the execution flow through conditional branching, looping, error handling, and environment configuration, while Variable Bricks facilitate dynamic data handling by creating, modifying, and retrieving variables. Together, they empower users to build adaptable flows that meet specific requirements with precision.

These Bricks are essential for:

  • Directing workflow execution: Control Bricks specify the order of tasks, implement decision-making logic based on conditions, and enable repetition across datasets or until conditions are met.
  • Managing data dynamically: Variable Bricks allow users to store, reuse, and modify data across flow components.
  • Handling errors and configurations: Control Bricks manage exceptions gracefully and configure flows for different environments, ensuring robustness.
  • Simplifying complexity: Both Control and Variable Bricks break down complex flows into manageable, maintainable parts by leveraging state management and dynamic inputs/outputs.

By effectively utilizing Control Bricks and Variable Bricks, users can create efficient, maintainable, and adaptable flows in CODED FLOWS that address diverse scenarios and technical needs.


Control Bricks

Control Bricks Location

All Control Bricks are included in the base package named FLOW CONTROL.

CREATE LIST

Creates an ordered list by connecting input arguments in sequential index positions. You can add a new list element by clicking on the plus button.

CREATE DICT

Creates a key-value dictionary by pairing named keys with their corresponding values. Key handles are labeled with descriptive names (e.g., "name", "age", "status") and connected to their respective value inputs. You can add a new key-value pair by clicking on the plus button.

EXECUTION ORDER

Ensures tasks within a flow are executed in a defined sequence. Trigger handles are labeled with a number (e.g., "1", "2") to denote execution order. Ideal for enforcing sequential task execution, such as loading data before processing it. You can add a new sequence by clicking on the plus button.

IF

Introduces conditional logic to execute tasks based on a specified condition, e.g., verifying a file’s existence before reading it. The condition input takes a boolean expression with two output triggers true and false for branching.

IF ANY

The IF ANY Brick evaluates whether a value has meaningful content, returning True if the value contains data and False if it's empty or None. Unlike the standard IF Brick that works with boolean conditions, IF ANY intelligently handles various data types and determines their "truthiness" based on content presence.

Behavior by Data Type

  • None: Always returns False
  • Booleans: Returns the boolean value itself
  • Numbers (int, float, complex, Decimal): Always returns True (including zero)
  • Strings/Bytes: Returns False for empty strings, True for non-empty
  • Collections (list, tuple, set, dict, deque): Returns False for empty collections, True for non-empty
  • Paths: Returns True if the path exists on the filesystem
  • DataFrames/Series: Returns True if not empty and contains non-null values
  • NumPy arrays: Returns True if array has elements (size > 0)
  • PyArrow Tables: Returns True if table has rows
  • DateTime objects: Always returns True
  • PIL Images: Returns True if image has dimensions > 0
  • File-like objects: Returns True if the object has content (attempts to check size)
  • Callable objects: Always returns True
  • Iterables: Returns True if the iterator produces at least one item
  • Other objects: Defaults to True

This Brick is particularly useful for conditional logic that needs to handle diverse input types and determine whether they contain meaningful data for further processing.

FOR

It repeats a task block over a specified range of indices, ideal for fixed iterations like processing a set number of items. It can derive indices from its inputs (start and end) or by defining their values in the options menu. It provides three outputs: the do trigger to specify the sub-flow to execute, index to access the current iteration number, and the finished trigger to specify a sub-flow to execute after the loop completes.

FOR EACH

The FOR EACH Brick iterates over an iterable, processing each element individually. The list input expects an iterable collection, and it provides four outputs: the do trigger to specify the sub-flow to execute, index to access the current iteration number, element to return the current element of the iterable, and the finished trigger to specify a sub-flow to execute after the loop completes.

WHILE

It repeats tasks while a condition remains true. It has two outputs: the do trigger to specify the sub-flow to execute and the finished trigger to specify a sub-flow to execute after the loop completes.

Input Tip

The WHILE Brick expects a condition input, which is preferably a boolean variable for optimal functionality, to dynamically control when the loop terminates by updating the variable value.

TRY CATCH

Manages exceptions by separating main execution, error handling, and cleanup tasks. It provides three triggers: the try trigger for primary task execution, the catch trigger for handling errors, and the finally trigger for tasks that must run regardless of success or failure.

PROJECT PATH

Outputs the current project directory path for use in the project.

LOAD ENV

Loads environment variables from a designated file in the project folder. You can specify the environment file (e.g., .env) in the options menu.

Variable Bricks

Variable Bricks Location

All Variable Bricks are included in the base package named VARIABLES. For UI flows, there is an additional package named SESSION VARIABLES.

New Variable

The New Variable brick allows users to create a new variable by specifying its name, data type, and initial value.

Get Variable

The Get Variable brick retrieves the current value of an existing variable for use in the flow.

Set Variable

The Set Variable Brick updates an existing variable's value by selecting it from a dropdown list and assigning a new value, which must match the variable's data type.

Previous
Types of Bricks