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

Managing Files

Twidget offers a set of commands to manipulate files in your file store. Below are the descriptions and usage of each command to help you understand how to utilize them effectively. For CSV, ZIP archives and temporary download links, see [Advanced file commands](/docs/commands/advanced-files). Get F...

Cryptography commands

Create checksums, protect text with encryption, sign and verify messages, and compare private text in endpoints, server functions and events. Find these commands under Security when adding a command. They use the familiar variable selector and Return as field. Keep shared signing keys in [Globals & ...

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

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

Read and create spreadsheets

Use Read spreadsheet and Create spreadsheet under File Manager in a server workflow. They work with XLSX files and simple typed cell values. For CSV text files, use [Advanced file commands](/docs/commands/advanced-files). Read spreadsheet. Choose File, containing its actual contents. Use an uploaded...