Sign Up
Loading...

Conditionals

Watch the walkthrough

Switch Command

Choose between workflow branches with the Switch command.

Recorded with an earlier Twidget interface. Names, control locations and available options may differ; use the linked documentation for current guidance.

Watch tutorial (1:45)

Condition Command

Use a condition to run different workflow branches.

Recorded with an earlier Twidget interface. Names, control locations and available options may differ; use the linked documentation for current guidance.

Watch tutorial (3:13)

Validate Command

Validate workflow inputs and return an error when a check fails.

Recorded with an earlier Twidget interface. Names, control locations and available options may differ; use the linked documentation for current guidance.

Watch tutorial (1:37)

Browse all video tutorials

Condition Command

The Condition Command allows you to perform actions based on whether an expression evaluates to true or false. You can nest other commands within the true or false branches of the condition, enabling complex logic flows.

Key Features:

  • Expression Builder: Validate two variables to equal true. Multiple expressions can be added; all expressions must be true for the condition to pass.

  • Nested Commands: Commands can be nested within the true and false branches.

  • Else If and Else Blocks: Support for multiple else if statements and a single else block, each containing its own nested commands.

Switch Command

The Switch Command allows you to validate a single variable against multiple case values. Each case can contain nested commands that will execute if the case value matches the variable. Additionally, a default block can be provided to handle cases where none of the specified cases are true.

Key Features:

  • Case Validation: Compare a variable against multiple case values.

  • Nested Commands in Cases: Each case block can contain commands that will execute if the case value matches the variable.

  • Default Block: When no cases match, the flow will enter the default block containing its nested commands.

Validate Command

The Validate Command ensures that specific expressions evaluate to true. If any of the expressions are false, the validate command will throw an error. You can specify custom error messages and server errors, including common HTTP status codes such as Bad Request, Unauthorized, etc.

Key Features:

  • Expression Validation: Validate multiple expressions.

  • Error Handling: Throw an error if any expression fails.

  • Custom Error Messages: Specify custom error messages and server error codes.

These commands enhance your ability to build complex, condition-based logic flows without having to write code. Utilize the Condition, Switch, and Validate commands to control the workflow dynamically based on variable values and expressions.

Related Topics

Database

Twidget offers many commands to manage data in your database. Below is a list of the available commands and their functionalities: Get Data. Retrieve an entry from a table. Get Multiple Data. Retrieve multiple entries from a table. Save Data. Save an object to a database table. Save Multiple Data. S...

Text

Twidget offers a variety of commands to manipulate text in various ways. To Uppercase. Converts all characters of the provided text to uppercase. - text: The text to be converted to uppercase. - A text string with all characters in uppercase. To Lowercase. Converts all characters of the provided tex...

Miscellaneous

Twidget provides several miscellaneous commands to facilitate various tasks. Is Null. Description: Checks whether the provided value is null or not. Inputs: - value: The value to be checked. Output: - boolean: Returns `true` if the value is null; otherwise, returns `false`. Not Null. Description: Ch...

AI connectors

For every command’s inputs, results, examples and common errors, open the [detailed connector reference](/docs/connectors/overview). The command editor’s help button opens its exact reference section. Use an AI provider from an endpoint, server function or event. Choose your organization's connector...

Date

Twidget offers a variety of commands to manipulate date objects. Below are the available commands along with their respective descriptions, inputs, and outputs. Current Date. Description: Returns the current date and time. Output: - Type: DATE Add Time. Description: Returns the date plus a specified...