Skip to content

Decision Table (SQL) ​

Evaluates an ordered set of SQL-condition rules against a connected SQL Server and returns the value of the first matching rule.

Purpose ​

Use this task to implement branching business logic without building nested If Statement nodes. Rules are defined as a JSON array of labeled conditions, each containing a SQL WHERE-style expression and an associated return value. The task evaluates rules in order and returns the result coerced to the chosen type. A legacy single-string expression format is also supported for migrating existing logic. Because conditions are executed inside a SQL CASE WHEN wrapper on the connected server, they can reference any data already available as workflow variables.

Inputs ​

FieldTypeRequiredDescription
Evaluation ModeDropdownYesStructured Table evaluates a JSON array of rules. Legacy Expression evaluates a single comma-separated clause string.
Rules JSONMulti-line TextNoOrdered array of rule objects, each with Label, Value, and Condition fields. Condition uses SQL WHERE syntax.
Legacy EquationMulti-line TextNoComma-separated clauses in the form Var = Value IF condition. Used when Evaluation Mode is Legacy Expression.
Else ValueTextNoValue returned when no rule matches. Leave blank to raise a failure when nothing matches.
Return TypeDropdownYesHow to coerce the matched value: number, string, boolean, or json.
Stop At First MatchCheckboxYesWhen checked, evaluation stops at the first matching rule. When unchecked, all rules are evaluated and the last match is used.
Condition SafetyDropdownYesControls SQL condition validation. Lenient (raw SQL) applies no checks. Safe (sanitize) blocks comment and injection tokens. Strict (allow-list) additionally restricts identifiers to those in the Allowed Columns field.
Diagnostics LevelDropdownYesControls how much diagnostic data is returned alongside the result: none, basic, or verbose.

Visibility Rules ​

Rules JSON is only shown when Evaluation Mode is set to Structured Table. Legacy Equation is only shown when Evaluation Mode is set to Legacy Expression.

Outputs ​

NameDescription
ResultThe value returned by the matched rule, coerced to the selected Return Type. Present when Diagnostics Level is none.
DiagnosticsAn object containing EvaluatedCount, MatchedIndex, MatchedLabel, and (in verbose mode) the preview SQL. Present when Diagnostics Level is basic or verbose.

Tentech