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

Conversion

Overview. Twidget's conversion commands allow you to easily convert different data types to the required format. Below is a list of the available conversion commands and examples of how to use them. The `Convert to Text` command converts the provided value to a text (string) format. Examples: - `123...

Lists

Twidget offers a variety of commands to help you manipulate lists easily without coding. Below is a detailed explanation of each command available. Transform a list. In an endpoint, server function or event, add a command and choose List. Use the commands below to select, reshape, order or combine i...

Error Handling

When building applications with Twidget, you may encounter situations where you need to handle errors gracefully to ensure your application runs smoothly. Twidget provides two powerful commands for error handling: `try-catch` and `throw-error`. This documentation will guide you on how to use these c...

Advanced file commands

Prepare CSV downloads, work with small ZIP archives and share a temporary download link from an endpoint, server function or event. Find these commands under File Manager when adding a command. Use the usual variable selector and Return as field. The existing file commands still handle storage, fold...

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...