# Utility workflow nodes

> Transform values, control event flow, run timers and schedules, and inspect live state with the general-purpose workflow nodes.

Use these nodes to transform values, control event flow, manage time, and inspect live workflow state.

## Choose a node

- [Event Switch](#event-switch): set one output value in response to named events
- [Priority Stack](#priority-stack): choose the highest-priority active input
- [Math](#math): perform arithmetic on two values
- [Clamp](#clamp): keep a number between a minimum and maximum
- [Logic Operation](#logic-operation): compare two values
- [Change Switch](#change-switch): emit an event when a boolean value changes
- [Case Switch](#case-switch): choose a result by matching a selector against configured cases
- [Static Value](#static-value): provide a fixed string, number, or boolean
- [String Merge](#string-merge): combine several values into one line of text
- [Value Mapping](#value-mapping): look up one or more inputs in a shared table of outputs
- [Counter](#counter): keep and change a numeric count
- [Button](#button): create a manual trigger inside the workflow editor
- [Delay](#delay): wait before passing an event or value onward
- [Interval](#interval): produce a repeating event and timestamp
- [Countdown](#countdown): count down from a duration
- [Stopwatch](#stopwatch): count elapsed time upward from zero
- [Event Order](#event-order): wait for named events in an expected order
- [Scheduler](#scheduler): fire an event according to a schedule
- [State Gate](#state-gate): allow or hold a value according to an open/closed state
- [Event Gate](#event-gate): allow or block events according to an open/closed state
- [Sample](#sample): hold the last value captured on a trigger event
- [Display](#display): show a connected value on the workflow canvas
- [Expression](#expression): calculate a result from an expression and named inputs

## Event Switch

Set one output value in response to named events.

### What you see in the editor

![The Event Switch node card with an Initial value of 0, four named events each setting a value, an Add Event control, a Reset input, and a Value output](https://bitfocus.io/api/docs-media/file/event-switch.png?prefix=docs-media)

- Set **Initial value**. Use **Add Event** to give each event a **Name** and the **Value** it should select.

### Connections

| Kind | Label | What it provides |
| --- | --- | --- |
| Input events | One per configured event | Select that event’s value. |
| Input event | **Reset** | Returns to the initial value. |
| Output | **Value** | The selected value. |

### Example

Add `on` and `off` events with Boolean values, then connect **Value** to a gate.

## Priority Stack

Choose the Id of the highest-priority input that's currently true.

### What you see in the editor

![The Priority Stack node card with a Fallback value, Mode set to Prioritize Top → Bottom, three named queue inputs, Add Input, and Value and Ordered outputs](https://bitfocus.io/api/docs-media/file/priority-stack.png?prefix=docs-media)

- Set **Fallback** (the value to output when nothing is active) and **Mode**: **Prioritize Top → Bottom**, **Prioritize Bottom → Top**, **Recent Change Has Priority**, or **Oldest Change Has Priority**. Use **Add Input** to add a boolean trigger, then select its row to set the **Id** it reports downstream and an optional **Label** shown only on the card, arranging entries in priority order for the two top/bottom modes.

### Connections

| Kind | Label | What it provides |
| --- | --- | --- |
| Inputs | One boolean trigger per configured input | Marks that input's **Id** active while the connected value is true. |
| Output | **Value** | The **Id** of the highest-priority active input, chosen by **Mode**, or **Fallback** when none are active. |
| Output | **Ordered** | Every currently-active input's **Id**, in priority order. |

### Example

Wire an emergency override, a manual control, and an automatic default into three inputs in that priority order, so **Value** always reports whichever one is genuinely in control right now.

## Math

Perform arithmetic on two values.

### What you see in the editor

![The Math node card with A and B input fields, the plus, minus, multiply and divide operator buttons, and the calculated result at the bottom](https://bitfocus.io/api/docs-media/file/math.png?prefix=docs-media)

- Choose the operation and supply the two values on the card or through connected inputs. A non-numeric connected value converts through `Number(...)`: a value that doesn't parse as a number produces a `NaN` result rather than an error, and dividing by `0` produces `Infinity`/`-Infinity` rather than an error.

### Connections

| Kind | Label | What it provides |
| --- | --- | --- |
| Inputs | **Value A**, **Value B** | The numbers to calculate with. |
| Output | **Result** | The calculation result. |

### Example

Multiply a normalized fader value by `100` to produce a percentage.

## Clamp

Keep a number between a minimum and maximum.

### What you see in the editor

![The Clamp node card with a Value input, Min and Max fields, and the clamped result at the bottom](https://bitfocus.io/api/docs-media/file/clamp.png?prefix=docs-media)

- Set **Min** and **Max**: **Min** must be less than or equal to **Max**, or the card shows a real validation error on the **Max** field. Then supply the value to limit. The card shows the result. A non-numeric connected **Value** converts through `Number(...)`; when that produces `NaN`, **Result** is `NaN` rather than being pinned to **Min** or **Max**.

### Connections

| Kind | Label | What it provides |
| --- | --- | --- |
| Input | **Value** | The number to limit. |
| Output | **Result** | The minimum, input value, or maximum as appropriate. |

### Example

Clamp a calculated percentage to the range `0`–`100` before displaying it.

## Logic Operation

Compare two values.

### What you see in the editor

![The Logic Operation node card with Value A and Value B inputs, an operator dropdown showing ==, and a Result output](https://bitfocus.io/api/docs-media/file/logic-operation.png?prefix=docs-media)

- Choose the operator and supply **Value A** and **Value B**. The dropdown offers three groups: comparison (**==**, **!=**, **>**, **<**, **>=**, **<=**, **===**, **!==**: note **==**/**!=** are loose equality while **===**/**!==** are strict), boolean logic (**AND**, **OR**, **XOR**), and the unary **NOT**. Choosing **NOT** hides the **Value B** field and handle entirely, since it only evaluates **Value A**.

### Connections

| Kind | Label | What it provides |
| --- | --- | --- |
| Inputs | **Value A**, **Value B** (**Value B** only exists when the operator isn't **NOT**) | The values to compare. |
| Output | **Result** | True or false. |

### Example

Compare a device mode with the text `record` and use **Result** to open a gate.

## Change Switch

Emit an event when a Boolean value changes.

### What you see in the editor

![The Change Switch node card with a single Value input and separate True and False outputs](https://bitfocus.io/api/docs-media/file/change-switch.png?prefix=docs-media)

- Connect the Boolean value. The card shows the latest true and false transition times.

### Connections

| Kind | Label | What it provides |
| --- | --- | --- |
| Input | Boolean value | The state to watch. |
| Output events | **True Result**, **False Result** | Fire when the value changes to that state. |
| Outputs | Transition timestamps | Show when each transition last occurred. |

### Example

Connect a feedback state and run an action only when it changes from false to true.

## Case Switch

Choose a result by matching a selector against configured cases.

### What you see in the editor

![The Case Switch node card with a Select input, four when-case inputs, Add Case, a Default input, and a No Match output](https://bitfocus.io/api/docs-media/file/case-switch.png?prefix=docs-media)

- **Select** and **Default** are connection-only inputs, not fields you type into on the card: feed them from another node such as a Static Value. Use **Add Case** to set **When**, the case value compared against **Select**, and an optional description. The **Result** output's own label updates live to show which case matched (**Case N**), or **Default** or **No Match** when none did.

### Connections

| Kind | Label | What it provides |
| --- | --- | --- |
| Input | **Select** | The value compared with each case. |
| Inputs | Case value handles | The result associated with each case. |
| Input | **Default** | Used when no case matches. |
| Output | **Result** | The selected result: the connected case, **Default**, or nothing (**No Match**) when neither applies. |

### Example

Match `rehearsal`, `live`, and `off-air` and output a label or setting for each mode.

## Static Value

Provide a fixed string, number, or Boolean.

### What you see in the editor

![The Static Value node card with a single value field and one output](https://bitfocus.io/api/docs-media/file/static-value.png?prefix=docs-media)

- Enter the value directly on the node. A small type toggle attached to the field switches between **String**, **Number**, and **Boolean**: switching type tries to convert the current value (`"42"` becomes the number `42`; `"true"` becomes the boolean `true`, matched case-insensitively) and falls back to that type's default (`0` or `false`) when it can't. Any other text is a valid string.

### Connections

| Kind | Label | What it provides |
| --- | --- | --- |
| Output | **Result** | The configured value. |

### Example

Provide a fixed threshold to **Logic** or a separator-independent label to **String Merge**.

## String Merge

Combine several values into one line of text.

### What you see in the editor

![The String Merge node card with a Separator field, three text inputs, Add Text Input, and a Result output](https://bitfocus.io/api/docs-media/file/string-merge.png?prefix=docs-media)

- Set **Separator**. Use **Add Text Input** to give each input a unique **Name** and optional description.

### Connections

| Kind | Label | What it provides |
| --- | --- | --- |
| Inputs | One per text input | Values combined in the displayed order. |
| Output | **Result** | The merged text. |

### Example

Combine a source label and destination label with \` → \` as the separator.

## Value Mapping

Look up one or more inputs in a shared table of outputs.

### What you see in the editor

![The Value Mapping node card with a preset input and a preset output showing the default value "Unknown"](https://bitfocus.io/api/docs-media/file/value-mapping.png?prefix=docs-media)

The card itself only shows the configured inputs and outputs: **Add Input**, **Add Column**, and the **Mappings** table aren't on the card at all. Select the node to open its **Configuration** panel, which is where this node is actually built:

![The Value Mapping node's Configuration panel, showing Inputs, Columns, and a Mappings table with one configured row (input value "1" mapped to "One") and the otherwise/default row set to "Unknown"](https://bitfocus.io/api/docs-media/file/value-mapping-inspector.png?prefix=docs-media)

- Use **Add Input** to define one or more named inputs, each set to handle type **State** (evaluated continuously as its value changes) or **Event** (evaluated only when an event arrives on it). Use **Add Column** to define one or more named output columns, each with a value type of Text, Number, or Boolean.
- Build the **Mappings** table: each row's **When input is** cell is matched against an input's value as text; the row's cells under each column supply that column's value when it matches. The final **otherwise** row is the **Default** used when no row matches. Only the first row matching a given value is used: the table flags duplicate **When input is** values with a warning.
- Every input is looked up independently against the same mapping table. Each input/column pair gets its own output, so with two inputs and three columns the node exposes six outputs in total.

### Connections

| Kind | Label | What it provides |
| --- | --- | --- |
| Inputs | One per configured input, named as configured | The value looked up against the mapping table (State), or the event that triggers a lookup (Event). |
| Outputs | One per input/column pair, labeled *input*.*column* | That input's matched (or default) value for that column. |
| Output events | One per input/column pair, for Event-type inputs | Fires with the matched (or default) value each time that input's event arrives. |

### Example

Map a connection's numbered preset state through one State input and three columns (`label`, `color`, `enabled`) to drive a button's display, instead of chaining several Case Switch nodes.

## Counter

Keep and change a numeric count.

### What you see in the editor

![The Counter node card showing its current count above the Set, Reset, Increase One, Increase Amount, Decrease One, and Decrease Amount inputs, with a Value output](https://bitfocus.io/api/docs-media/file/counter.png?prefix=docs-media)

- The **+**/**−** buttons on the card increase or decrease the count by one directly, and clicking the displayed count lets you type a new one: both act the same as connecting to **Increase One**/**Decrease One**/**Set**. **Reset**, **Increase Amount**, and **Decrease Amount** have no card control at all; connect an event to them from another node. **Increase Amount** and **Decrease Amount** need that event to carry a numeric payload, not just a trigger.

### Connections

| Kind | Label | What it provides |
| --- | --- | --- |
| Input events | **Set**, **Increase One**, **Decrease One** | Also triggerable directly from the card. |
| Input events | **Reset** | Returns to the node's configured starting value; connection-only, no card button. |
| Input events | **Increase Amount**, **Decrease Amount** | Adjust by the connected event's numeric payload; connection-only, no card button. |
| Output | **Value** | The current count. |

### Example

Count completed cues and reset the count at the beginning of rehearsal.

## Button

Create a manual trigger inside the workflow editor.

### What you see in the editor

- Press **Press** on the node card to fire it. The card shows the latest timestamp. **Press** stays disabled, with a tooltip explaining why, until the workflow has been applied at least once after the node was added.

### Connections

| Kind | Label | What it provides |
| --- | --- | --- |
| Output event | **Event** | Fires on each press. |
| Output | **Timestamp** | The time of the latest press. |

### Example

Use a Button to test a downstream chain before connecting a live event source.

## Delay

Wait before passing an event or value onward.

> See [Sequence a timed automation](/docs/buttons/v1.10/workflows/recipes/timing) for a full walkthrough combining Delay, Interval, Scheduler, Countdown, and Stopwatch, including what each remembers across a reload or restart.

### What you see in the editor

![The Delay node card with a Delay (ms) field set to 1000, a Payload input, and a Passthrough output](https://bitfocus.io/api/docs-media/file/delay.png?prefix=docs-media)

- Set the delay duration shown on the card.

### Connections

| Kind | Label | What it provides |
| --- | --- | --- |
| Input event | **Event** | Starts a delayed event. |
| Input | **Payload** | The value to delay. |
| Output event | **Out** | Fires after the event delay. |
| Output | **Passthrough** | Provides the delayed value. |

### Example

Delay a follow-up action by two seconds after a test trigger.

## Interval

Produce a repeating event and timestamp.

### What you see in the editor

![The Interval Timer node card with an Interval (ms) field set to 1000 and Timestamp and Event outputs](https://bitfocus.io/api/docs-media/file/interval-timer.png?prefix=docs-media)

- Set the interval on the node card.

### Connections

| Kind | Label | What it provides |
| --- | --- | --- |
| Output event | **Event** | Fires at each interval. |
| Output | **Timestamp** | The latest interval time. |

### Example

Refresh non-critical display logic every 30 seconds.

## Countdown

Count down from a duration.

### What you see in the editor

- Toggle looping on the card, and use its controls to start, pause, reset, restart, or directly set the displayed time. **Initial Duration** is not a field you type into on the card: it's a connection input, fed from another node such as a Static Value. The displayed time always updates every 100ms and never shows milliseconds; neither is currently configurable from the UI.

### Connections

| Kind | Label | What it provides |
| --- | --- | --- |
| Input events | **Start**, **Pause**, **Reset**, **Restart**, **Set**, **Add Time**, **Subtract Time** | Control the timer. |
| Inputs | **Initial Duration** | The duration to count down from. |
| Outputs | Remaining time, progress, running and finished state | Show the current timer state. |
| Output events | **Started**, **Paused**, **Finished** | Report timer transitions. |

### Example

Run a five-minute presenter timer and trigger a notification from **Finished**.

## Stopwatch

Count elapsed time upward from zero.

### What you see in the editor

- Use the card controls to start, pause, reset, or set elapsed time, and toggle **Run on startup** to have a fresh node start counting on its own. The displayed time always updates every 100ms and never shows milliseconds; neither is currently configurable from the UI.

### Connections

| Kind | Label | What it provides |
| --- | --- | --- |
| Input events | **Start**, **Pause**, **Reset**, **Set** | Control elapsed time. |
| Outputs | Elapsed time and running state | Show the current stopwatch state. |
| Output events | **Started**, **Paused** | Report timer transitions. |

### Example

Measure an operation from its start event until its completion event.

## Event Order

Wait for named events in an expected order.

### What you see in the editor

![The Event Order node card set to Reset mode with ten event inputs, a Reset input, and Next, State, and Fulfilled outputs](https://bitfocus.io/api/docs-media/file/event-order.png?prefix=docs-media)

- Set **Mode**: **Reset** restarts the sequence from **Event 1** if an out-of-order event arrives; **Wait** ignores it and keeps waiting for the same expected event instead. Set **Inputs** (2–20) to change how many numbered event handles the card shows.

### Connections

| Kind | Label | What it provides |
| --- | --- | --- |
| Input events | **Event 1** through **Event N**, one per **Inputs** | Must arrive in order, **Event 1** first, to advance the sequence. |
| Input event | **Reset** | Manually restarts the sequence from **Event 1**. |
| Output | **Next** | The number of the next expected event. |
| Output | **State** | `true` once every event has arrived in order; resets on the next restart. |
| Output event | **Fulfilled** | Fires once, when the final configured event completes the sequence. |

### Example

Require `prepare`, then `ready`, then `take` before continuing.

## Scheduler

Fire an event according to a schedule.

### What you see in the editor

![The Scheduler node card set to Monthly, with month, day-of-month, hour, minute, and second selectors, a plain-language summary of the resulting schedule, and Timestamp and Event outputs](https://bitfocus.io/api/docs-media/file/scheduler.png?prefix=docs-media)

- Enter the schedule on the node card using the format presented by the editor.

### Connections

| Kind | Label | What it provides |
| --- | --- | --- |
| Output event | **Event** | Fires at each scheduled time. |
| Output | **Timestamp** | The latest scheduled time. |

### Example

Start a daily housekeeping workflow at a known off-air time.

## State Gate

Allow or hold a value according to an open/closed state.

### What you see in the editor

![The State Gate node card shown twice: in State control mode with an Open State switch, and in Event control mode with Set Open, Set Closed, Toggle, and Reset inputs, each with Payload and Fallback inputs and Is Open and Value outputs](https://bitfocus.io/api/docs-media/file/state-gate.png?prefix=docs-media)

- Choose **Control Mode**: **State** or **Event**, and set an optional **Fallback**.
- In **State** mode, **Open State** is a switch you can click directly, or a connection target: feed it a value instead of clicking it to derive the gate's state from elsewhere. In **Event** mode, connect **Set Open**, **Set Closed**, **Toggle**, or **Reset** from another node's event output instead, and set **Initially Open** for its starting state.

### Connections

| Kind | Label | What it provides |
| --- | --- | --- |
| Input | Value | The value controlled by the gate. |
| Control inputs/events | State or event controls | Open or close the gate. |
| Output | **Is Open** | The gate state. |
| Output | **Value** | The passed, retained, or fallback value. |

### Example

Prevent an automatic value from changing a downstream setting until an enable state is true.

## Event Gate

Allow or block events according to an open/closed state.

### What you see in the editor

![The Event Gate node card shown twice: in State control mode with an Open switch, and in Event control mode with Set Open, Set Closed, Toggle, and Reset inputs, each with an Event input and Is Open and Out outputs](https://bitfocus.io/api/docs-media/file/event-gate.png?prefix=docs-media)

- Choose **Control Mode**: **State** or **Event**.
- In **State** mode, **Open** is a switch you can click directly, or a connection target: feed it a value instead of clicking it to derive the gate's state from elsewhere. In **Event** mode, connect **Set Open**, **Set Closed**, **Toggle**, or **Reset** from another node's event output instead, and set **Initially Open** for its starting state.

### Connections

| Kind | Label | What it provides |
| --- | --- | --- |
| Input event | **Event** | The event to control. |
| Control inputs/events | State or event controls | Open or close the gate. |
| Output | **Is Open** | The gate state. |
| Output event | **Out** | Fires only when the incoming event is allowed through. |

### Example

Block a take event until a separate ready state opens the gate.

## Sample

Hold the last value captured on a trigger event.

### What you see in the editor

![The Sample node card with Value and Trigger inputs on the left, and Value and Out outputs on the right](https://bitfocus.io/api/docs-media/file/sample.png?prefix=docs-media)

- Connect a value to **Value** and an event to **Trigger**. Each time **Trigger** fires, the node captures whatever **Value** currently holds, publishes it on **Out**, and keeps it as the card's held value until the next trigger.
- The held value is empty until the first trigger.

### Connections

| Kind | Label | What it provides |
| --- | --- | --- |
| Input | **Value** | The value captured on each trigger. |
| Input event | **Trigger** | Captures the current **Value**. |
| Output | **Value** | The most recently captured value, held until the next trigger. |
| Output event | **Out** | Fires with the captured value each time **Trigger** fires. |

### Example

Sample a connection's live level reading only when a cue fires, so downstream nodes see a stable snapshot instead of continuous updates.

## Display

Show a connected value on the workflow canvas.

### What you see in the editor

![The Display node card showing the type icon and current value of whatever is connected to its input](https://bitfocus.io/api/docs-media/file/display.png?prefix=docs-media)

- There's no control to choose: the card detects and labels the connected value's type on its own (**String**, **Number**, **Boolean**, or **Object**; an unconnected input just reads **undefined**). A string, number, or boolean renders as a large plain value; an object or array renders as a collapsible JSON tree instead. Before the workflow is applied at least once, the card shows **Apply to activate** in place of any value.

### Connections

| Kind | Label | What it provides |
| --- | --- | --- |
| Input | Value | The value to display. |

### Example

Place Display nodes after important calculations to see their live values while testing.

## Expression

Calculate a result from an expression and named inputs.

### What you see in the editor

![The Expression node card with a concat expression in its editor, three named variable inputs, Add Input, and the evaluated Result](https://bitfocus.io/api/docs-media/file/expression.png?prefix=docs-media)

- Enter the expression. Use **Add Input** to give each input a unique **Name** (letters and numbers only, must start with a letter, and unique among the node's inputs: the field turns red with an inline message otherwise) and optional description, then refer to it as `$(name)` in the expression. A malformed expression underlines the error inline and turns the whole node's border red; an empty expression fails with **Expression is empty.**
- Two variables are always available without adding an input: `$(self.label)`/`$(self.id)` for this node's own label and id, and `$(time.hh:mm:ss)`/`$(time.hh)`/`$(time.mm)`/`$(time.ss)` for the current time.

### Connections

| Kind | Label | What it provides |
| --- | --- | --- |
| Inputs | One per configured name | Values available to the expression. |
| Output | **Result** | The evaluated result. |

### Example

Add `level` and `offset` inputs and calculate a corrected display value.
