Conditional IF node

Conditional IF node

Conditional branching node

cond_1

A Conditional branching node is a special tool in Scade.pro workflows that helps make decisions based on specific rules or conditions. It looks at input data and decides which direction the workflow should take. This makes workflows smarter and more efficient.

Why use a Conditional branching node?

Dynamic workflows

Adjust the workflow automatically based on the input data.

Save time and resources

Skip unnecessary steps, making the workflow faster.

Custom logic

Create workflows that can handle different situations without needing separate setups.

Flexibility

Easily adapt workflows to different user needs or scenarios.

How does it work?

  1. Set a condition

The node checks a condition, like “Is the input image provided?” or “Did the user select a specific model?”.

Example of a condition:

“condition”: “{{context[‘start’][‘Model’] == ‘Quality’}}”

This checks if the “Model” input is set to “Quality.”

  1. Follow the path

If the condition is true, one path is followed.

If the condition is false, another path is used.

  1. Connect to other nodes

You can connect the outputs (true or false) to different parts of your workflow.
Example is based on the FLUX models template.

Examples of conditions

  1. Equal (==)

Example: Check if the selected model is “Quality.”

“{{context[‘start’][‘Model’] == ‘Quality’}}”

  1. Not equal (!=)

Example: Check if the user did not provide an image.

“{{context[‘input’][‘image’] != None}}”

  1. Greater than (>) or Less than (<)

Example: Check if the width of the image is greater than 1024.

“{{context[‘image’][‘width’] > 1024}}”

  1. Logical AND (&&)

Example: Check if the model is “Quality” and the height is greater than 512.

“{{context[‘model’] == ‘Quality’ && context[‘height’] > 512}}”

  1. Logical OR (||)

Example: Check if the model is “Speed” or “Quality.”

“{{context[‘model’] == ‘Speed’ || context[‘model’] == ‘Quality’}}”

If you are an experienced user, please refer to the Jinja2 expressions documentation available at: Jinja2 Expressions.

When using a tumbler in the start node, you can connect to the node directly without stating conditions.
In case we have true

and false

Best practices

Write clear conditions:

Keep the logic simple and easy to understand.

Avoid unnecessary steps:

Only add branches when they add value to the workflow.

Test all paths:

Ensure that both true and false branches work correctly.

By using Conditional branching nodes, you can make workflows in Scade.pro smarter, faster, and more tailored to different needs!