Case
Run one of several sets of actions, chosen by the value of a string column
Ingredient Family: rowActionsIngredients
Outline Display: Depending on the value of {{onColumn}}, perform: {{branches}}
Details
Use this instead of nesting If conditions when the choice is which of several values a single column holds: one branch per value, each named by the value that selects it. Give the branch keys the parameter’s allowedValues and the check will tell you if the two ever disagree – a value with no branch, or a branch for a value the parameter does not allow.
The column dispatched on has to be a required string: an option string parameter cannot be dispatched on, so declare the parameter required: true before a Case reads it.
Columns every branch adds are visible to later steps; a column only some branches add is not. The steps after this one run whichever branch ran, so only a column that every branch produces, under the same name and at the same type, is there for them to read; anything else is dropped at the merge. Branches that agree on a name but not a type fail the check rather than silently dropping it. A Case with one branch therefore passes that branch’s columns straight through.
A value no branch matches fails the action as a malfunction, naming the value: the step cannot fall through, because the steps after it were type-checked against the merged columns and there would be none. That is a pipeline mistake rather than bad data whenever the branch keys cover the parameter’s allowed values, which is why the check insists they do.
Local scope
The parent slot binds these (look up the slot in the parent to see how):
$table– The table to act on
Names introduced within this component’s knobs:
$table/case– empty table populated by ingredients
Settings
Required
onColumn: column of$table(type filter: exactly text; required, non-nullable)
The column whose value chooses the branch to run
Optional
branches: ingredient slot ofcaseBranchIngredients($table/case)(many)
The branches, one per value the column may hold