Ir para o conteúdo

Lição 18 · Controls and Interactivity

Actions and Interactivity

Make Sigma workbooks interactive with actions: triggers, effects and conditions for filtering, navigation, modals and input tables, designed safely.

Controls let readers choose values. Actions let a workbook respond to what readers do: click a bar and filter a table, press a button and open a detail pop-up, or submit a row to an input table.

Anatomy of an action

Sigma's documentation describes each action with:

  • A trigger: the user interaction that starts it.
  • An effect: what happens.
  • An optional condition: when it is allowed to happen.
flowchart LR
  A["Trigger: click"] --> B{"Condition true?"}
  B -->|yes| C["Effect runs"]
  B -->|no| D["Nothing happens"]

Each action connects an interaction to a result.

Triggers

Examples from the documentation:

Element Triggers
Tables and input tables Selecting a cell, a custom context menu item
Pivot tables Selecting, context menu, cell edit (beta)
Charts Selecting a data point or category, context menu
Buttons and images Click
Controls Value change
Modals Primary click, secondary click, close

A control's change trigger does not fire when another action or a URL parameter sets its value. Actions also do not fire while the trigger element is maximized. Both details explain some "my action does nothing" puzzles.

Effects

Effects are grouped like this:

Group Examples
Navigation Open a link or document, move within the workbook, notify and export
Controls Set or clear a control value
Elements Modify or refresh an element
Layout Open or close a modal, select a tab
Input tables Insert, update or delete a row
Advanced Call an API or stored procedure, call an agent

The documentation notes that the refresh element effect is not for materialized elements. The list grows over time, so check the current docs.

Pattern 1: click to filter

A reader clicks a region bar. An action sets a control to that region. The detail table is filtered by the control.

TEXT
Trigger:  Select a bar in "Revenue by region"
Effect:   Set control value Region-Picker = selected region
Also:     A "Clear selection" button clears the control

The reader needs a way to get back. A visible control plus a clear button is enough.

Pattern 2: drill to detail

A reader selects a customer row. An action opens a modal showing that customer's orders. The main page stays simple, and detail appears only when asked for.

Pattern 3: submit a request

A form-like page collects values with controls, and a button inserts a row into an input table. Add a condition so the button works only when required fields are filled, and clear the controls after a successful insert.

JS Stand-in: a condition guarding a submit action

Press Run (or Ctrl + Enter) to see the console output here.

No output.

This is not Sigma code. It shows why conditions matter: invalid requests should not reach your data.

Action sequences

Several effects can run one after another, such as: insert a row, close the modal, refresh the list and show a message. Sigma offers action sequences for this. When order matters, test what happens if a middle step fails. A half-finished sequence can leave data confusing.

Actions that reach outside

Some effects call an API or a stored procedure. These can change systems beyond your workbook, so treat them like software:

  • Ask the user to confirm before destructive or costly steps.
  • Give the called service only the access it needs.
  • Never send more data than required.
  • Keep secrets out of formulas, text elements and URLs.
  • Plan for retries, so a double click does not create two orders.

If an action can send messages, spend money or delete records, add a human review step. The AI agents tutorial discusses similar safeguards for automated actions.

Python Stand-in: make a repeated click safe

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

A unique request ID lets the receiving system ignore repeats. This property is called idempotency.

Make interactions discoverable

Readers do not know that a chart is clickable unless you tell them. Add a short hint ("Click a bar to filter the list"), use buttons for important actions, and keep the effect predictable. Avoid chains where one click changes many things on other pages.

Test actions

Test each action as a user with limited access. Check empty selections, several rapid clicks, long text, a user without write access, and what the reader sees when something fails.

Common mistake: hiding a button and believing the action is now protected. Permissions on data and external systems must enforce who can do what.

Document your actions

Actions are harder to discover than formulas, so keep a short list on a notes page. For each action, record the element that triggers it, the condition, the effects in order and the person who owns it. When someone renames a control or removes a column, this list tells you what to test.

Review the list before each publish. An action that nobody can explain is a good candidate for removal, especially if it changes data or calls another system.

Design for failure

Think about what the reader sees when an action cannot finish. A missing permission, an empty selection or an external service that does not answer can all stop it. Where possible, show a clear message, keep what the reader typed and say what to do next. After any action that changes data, show the new state, such as the added row or the updated status, so people do not click again to check whether it worked. Test that message too, using an account that is expected to fail.

Check your understanding

Quick check · 4 questions

of 4 answered You scored / 4 · perfect!

  1. 1. Which parts make up a Sigma action?

    An interaction triggers an effect, possibly limited by a condition.
  2. 2. Does a control change trigger fire when another action sets its value?

    The change trigger does not fire for values set by actions or URL parameters.
  3. 3. What protects against a double click creating two orders?

    The receiving system can recognize and ignore a repeated request.
  4. 4. What should a click-to-filter design include?

    Readers need a visible way to return to the full view.

Summary

  • Actions connect triggers to effects, optionally under conditions.
  • Common patterns: click to filter, drill to a modal and submit a form.
  • Remember the limits, such as a change trigger not firing for values set by actions.
  • External effects need confirmation, least access and repeat protection.
  • Test with realistic users and make interactions visible.

Next: Input Tables

Seu progresso fica salvo neste navegador. Não precisa de conta.