Actions in the classic Workbook Editor
This page covers actions in workbooks built with the classic Workbook Editor. A Data App has no Actions editor: it handles interactions in its own code and runs Business Workflows authored in the semantic layer.
An action is a stack of blocks that runs when something happens in a workbook: a viewer selects a button, a filter changes, a timer fires or a sheet opens. You build it in the Actions editor by dragging blocks from a catalog and snapping them together. For what each block does, see Action blocks.
How actions work
Section titled “How actions work”Every action has three parts:
- A trigger starts it. Triggers are in the Controls, Events and Embeds categories, for example When object emits event do, Enter: sheet or Before workbook opens. A trigger must be the first block in the stack.
- Logic is optional. Blocks such as if, if / else and Switch choose which blocks run, and operators compare or combine values.
- Outcomes change the workbook: go to a sheet, set or clear filters, set a variable, refresh data, write back to your warehouse, send a notification or produce a report.
For example, a regional sales sheet has a button for each region. Each button’s action starts with a When button emits On click do trigger and holds three outcomes: Set filter narrows the workbook to that region, Set variable to stores the choice, and Go to opens the regional detail sheet.
Actions belong to the whole workbook, so a trigger can react to an object on any sheet. They run only when the workbook is viewed: in Preview workbook or Preview sheet, as the published workbook, or in an embed. They do not run on the edit canvas.
Open the Actions editor
Section titled “Open the Actions editor”- Open the workbook in edit mode.
- In the toolbar on the left of the editor, select Actions.

A button’s Style tab, and the Data tab of an input object, also have an Actions section with an Actions button that opens the same editor.

The block catalog is on the left and the canvas is in the middle. Until a workspace has blocks, the canvas reads You haven’t added any action blocks here yet.; select Get started to open the catalog.
Organize actions in workspaces
Section titled “Organize actions in workspaces”You can spread actions over several workspaces to keep them findable. All workspaces apply to the whole workbook.
The Organize: dropdown at the top of the editor lists the workspaces. Select Add Workspace to add one, or open the menu beside a workspace for Rename, Copy, Duplicate and Delete. Delete is unavailable while the workbook has only one workspace.

The toolbar on the right holds Copy and Paste, Undo and Redo, a menu to expand or collapse all blocks, Add Comment, Fit to screen and the zoom controls. The keyboard icon lists the editor’s shortcuts.
Build an action
Section titled “Build an action”- In the catalog, open a Triggers category and drag a trigger onto the canvas.
- Drag the blocks that should run into the trigger, in the order they should run. Blocks in a stack run from top to bottom.
- Set each block’s fields and dropdowns, such as the sheet, field, values or variable.
- Preview the workbook and try the action.
A block connects only where it fits the flow. A block that returns a value fits only an input that accepts that type, such as a number or a Boolean. A connected block with an invalid value, such as a trigger that refers to a button that no longer exists, is drawn in red and cannot run.
To detach a block, drag it away; with Alt (⌥ on a Mac) held, you move one block without the
blocks below it. To remove a block, drag it back to the catalog, or select it and press Delete.
Blocks that are not attached to a trigger do not run, so you can park a block on the side of the
canvas.
Block categories
Section titled “Block categories”The catalog groups categories under these headings. Some categories appear only when the matching feature is enabled for your account.
| Group | Categories |
|---|---|
| Triggers | Controls, Events, Embeds |
| Workbook | Navigation, Filter / Data, Objects, Variables, Export, Other |
| Workflows | Writeback & SQL; when enabled, AI & LLM, Notifications, Workflows and Alerts |
| Reporting | Reporting; when enabled, PDF reporting, Excel reporting and PowerPoint reporting |
| Logic | Conditions, Error handling |
| Operators | Logical, Number, Text, Date, Other operators |
| Procedures | Procedure, when enabled |
| Lists and Loops | List and Loop, when enabled |
Search, at the top of the catalog, finds blocks by name. For the topics with their own pages, see Writeback, Embed events, PDF reports, Excel and PowerPoint reports, Alerts and AI insights from an action.
Replace a deprecated block
Section titled “Replace a deprecated block”When a block gains new options, its earlier version is sometimes deprecated. Existing workbooks keep it, drawn in grey with [DEPRECATED] before its name, and it is no longer in the catalog. Replace it with the current version:
- When the block shows a replace icon, select it (Replace with the latest version). The current version takes the old block’s place, connected to the same blocks. Set its fields again to match the old block.
- Otherwise, drag the current version from the catalog, set it up like the old block, put it above the old block in the stack, then remove the old block.
![Deprecated grey Set and Get variable blocks marked [DEPRECATED], each followed by the current Set … to and Get … value blocks.](/help-center/6459667-astrato-action-blocks-automating-interactive-workflows/a6f1dc96b1d6.png)
Debug an action
Section titled “Debug an action”When an action does not behave as expected, find out which blocks run and what values they see.
Turn on action logging
Section titled “Turn on action logging”Action logging writes a console entry for each block that runs. It is controlled by a key in your browser’s local storage.

- Open your browser’s developer tools (
F12in Chrome, orCmd+Option+Ion a Mac). - Go to Application > Local storage and select the origin the workbook loads from: the address in the address bar or, for an embedded workbook, the address of the embedded frame.
- Add the key
astrato_action_printing_loggerwith the valuetrue. - Open or reload the workbook in Preview workbook, Preview sheet or as the published workbook, so its triggers start again with logging on.
Local storage outlasts the tab and the browser session, so logging stays on until you delete the
key or set it to anything other than true.
The key astrato_action_logger set to true turns on the same log with colored labels, and
writes each entry’s details as an expandable object instead of a line of text. When both keys are
true, astrato_action_printing_logger wins.
Read the log
Section titled “Read the log”Open the Console tab. To cut the noise, hide entries that do not start with [AstratoAction].

When the workbook loads, each trigger writes an entry as it starts listening:
[AstratoAction] Start listening subscription: astrato_object_event_button_interaction {"time":1782300415883,"executionId":1,"blockDetails":{"id":"Qgjx`I820xb#M9=_w#K:","type":"astrato_object_event_button_interaction","parentBlock":{}}}A trigger with no such entry is not listening, so its action cannot run. When you trigger the
action, every block that runs writes a [AstratoAction] ▶ START: entry when it begins and a
[AstratoAction] ■ END: entry when it finishes, followed by the block type and these details:
| Field | Meaning |
|---|---|
time |
When the entry was written, in milliseconds since the Unix epoch |
executionId |
A counter that rises with each entry since the page loaded; use it to order entries |
id |
The ID of the block that wrote the entry |
type |
The block type |
parentBlock |
The id and type of the block this one is attached to; blank for a trigger |
To keep the log, right-click in the console and select Save as.
Find the block that wrote an entry
Section titled “Find the block that wrote an entry”- Copy the block’s
idfrom the entry, for exampleQgjx`I820xb#M9=_w#K:. - In the Actions editor, select the search icon (Search your actions,
Ctrl+For⌘+F) and paste the ID. The search covers every workspace in the workbook. - Select the result to show the block.
To find the block it is attached to, search for its parentBlock ID.
Report values as the action runs
Section titled “Report values as the action runs”Logging shows which blocks run, not what values they work with. Add one of these blocks where you need to see a value:
- Log writes a value to the browser console. Join a label to the value, such as
my value is:followed by Get variable value, so you can tell entries apart. - Show toast message shows the value on screen. Set Type to Info, Success,
Warning or Error, and Hide automatically to
trueso it closes by itself. Every viewer sees a toast, so remove debugging toasts before you share the workbook.
Checklist
Section titled “Checklist”- The logging key is
truein local storage for the origin the workbook loads from. - You reloaded the workbook in a preview, published or embedded view after setting the key.
- The console filter is not hiding
[AstratoAction]entries. - You found the block by its
idwith Search your actions. - You deleted the key when you finished.
If the log shows the workbook doing too much at once, see Reduce the work actions do.
Recipes
Section titled “Recipes”Each recipe names the blocks to use. After pasting copied blocks, pick your own sheets, fields, objects and variables in their dropdowns.
Copy actions to another workbook
Section titled “Copy actions to another workbook”Select blocks and press Ctrl+C (⌘+C on a Mac), or select Copy in the toolbar; with nothing
selected, Copy takes the whole workspace. To copy a workspace from the Organize: dropdown,
select Copy in its menu. Then open a workspace in this or another workbook and press Ctrl+V
(⌘+V) or select Paste.
Blocks copied this way are text on your clipboard, so you can also paste a block definition that someone shares with you.
Apply a default filter when the workbook opens
Section titled “Apply a default filter when the workbook opens”Put Set filter field to values as Applied under Before workbook opens. That trigger runs before objects load, so charts query the filtered data from the start. It runs in workbook embeds too, but not when a report is produced.

To reapply the filter every time a viewer returns to a sheet, put the same block under Enter: sheet. Set filter replaces the values already selected in that field; to add to them, use Append to filter field values values as state instead.
To keep a field filtered to exactly one value, see Keep exactly one value selected.
Filter a field from a single-select dropdown
Section titled “Filter a field from a single-select dropdown”A dropdown bound to a variable is an alternative to Always one selected fields:
- Create a variable that holds the selected value, with the value to start on as its default.
- Add an input object, set its input type to Dropdown, and choose the variable.
- Create a procedure that sets the field’s filter to Get variable value, and run it from both Before workbook opens and Variable change: variable.

The field stays at one value only while viewers cannot filter it any other way. Hide it from the filter bar with Hide fields, leave it out of filter objects, turn off filtering on the charts that use it, and turn on Hide Clear all button. See Filters.
Run different blocks on each sheet
Section titled “Run different blocks on each sheet”Under Enter: Any sheet, add a Switch block and attach Get Active Sheet > Name to it. Add a case for each sheet name, with the blocks for that sheet, and use Default for the rest.

Keep sheet-entry actions from undoing a bookmark
Section titled “Keep sheet-entry actions from undoing a bookmark”A bookmark that opens a sheet also triggers that sheet’s Enter: actions, which can clear or
overwrite the filters the bookmark just applied. Test Bookmark-triggered Navigation, which is
true when a bookmark opened the sheet. It works only under an Enter: or Exit: trigger;
elsewhere it returns false.

To use this example, copy the definition and paste it into a workspace:
{ "serializedActions": { "type": "astrato_actions_event_enter_sheet", "id": "1kTLWAL^Z?FsqqsuBNhW", "x": -382, "y": -1013, "fields": { "sheetId": "Any sheet" }, "inputs": { "DO": { "block": { "type": "controls_ifelse", "id": "yzb?L7ifDjWIP[==~x@Y", "inputs": { "IF0": { "block": { "type": "bookmark_triggered_navigation", "id": "B~e@eE[PG{?n#iz7w^Ex" } }, "DO0": { "block": { "type": "console_log", "id": "uGdkC;cDJdkcfzy,QFxw", "inputs": { "text": { "shadow": { "type": "custom_text", "id": "_HRXeZpthFi(utN!gMuh", "fields": { "TEXT": "Do nothing, if navigation triggered by bookmarks" } } } } } }, "ELSE": { "block": { "type": "clear_filter_v1", "id": "RUcG6uO0*|{blu+j:X8,", "fields": { "clear_filter_state": "APPLIED_AND_PENDING" } } } } } } } }, "workspaceId": "_48)#y#-qBus#;GdUESe"}Keep filters per sheet
Section titled “Keep filters per sheet”Filters apply to every sheet in a workbook. To give each sheet its own, save and restore them with a private bookmark named after the sheet:
- Under Exit: Any sheet, add Create or update private bookmark. Build its name by
joining Get Active Sheet > Id to a suffix such as
|FilterState. Set Include sheet tofalse, and Include filters, Include state and Include variables totrue. - Under Enter: Any sheet, add Apply Private bookmark with the same name.

A private bookmark belongs to the viewer who created it, so each viewer keeps their own filters. See Bookmarks.
Save a personal default view
Section titled “Save a personal default view”- Under the trigger of a button, such as Save as default view, add Create or update private bookmark and name the bookmark with Get Current User > Name > Full Name.
- Under Before workbook opens, add Apply Private bookmark with the same name.

Wait for an object before changing it
Section titled “Wait for an object before changing it”An action under Before workbook opens or Enter: can run before a chart or table has rendered, and then fails or has no effect. Put Wait for object before the blocks that change the object, and select the objects to wait for; a container or group includes its child objects.
If an object is not ready within 120 seconds, the action stops with an error naming the objects. To wait longer, up to 600 seconds, place the blocks inside Query timeout seconds. See Give a slow query more time.
Filter the last 7 days
Section titled “Filter the last 7 days”Use Set filter field from start to end as state on a date field. For the
start, use add -7 Days to date(time) of Get Date & Time > Today Date; for
the end, add 0 days.

The range includes both ends, so -7 to 0 covers eight days. For exactly seven, use -6 to 0
to include today, or -7 to -1 for the seven full days before today, which suits data that
refreshes once a day. Today Date comes from the viewer’s device clock.
Filter the previous month, quarter or year
Section titled “Filter the previous month, quarter or year”- Choose a base date: Today Date, or Aggregate date field by Max for the latest date in your data, which keeps the range from being empty when data arrives late.
- Shift it with add
-1Months to date(time). - Take get start of Month from date(time) of the result, and store it in a
variable such as
prev_month_start. - Take get end of Month from date(time) of the same result, and store it in
prev_month_end. - Apply both with Set filter field from start to end.

For a quarter or year, use Quarters or Years and Quarter or Year instead.
Before you store a date in a variable, pass it through a date block such as get start of Day from date(time), so that text such as Today Date becomes a date value.

Offer preset date ranges in a dropdown
Section titled “Offer preset date ranges in a dropdown”- Create a String variable, and an input object with input type Dropdown bound to it, whose
options are the range names, such as
Last 24 Hours,Last 7 DaysandLast 14 Days. - Under Variable change: variable, add Switch on Get variable value, with a case for each range name.
- In each case, add Set filter date field from start to end. For the start, use
add
-24Hours or add-7Days to date(time) of Get Date & Time > Today Date & Time (ms); for the end, use the current time.

Filter a date range from buttons
Section titled “Filter a date range from buttons”
Buttons for the ranges viewers use most save opening a date picker each time. Put the shared
blocks in one procedure, here Filter last x days, with a parameter for the number of days:
- In the procedure, reset every button’s background with Set button container Frame Background Color.
- Use Switch on the parameter to give the pressed button a highlight color.
- Apply Set filter date field from start to end, with the start that many days before Today Date and the end one day before it.
- Under each button’s When button emits On click do, run the procedure with that button’s number of days.

Filter from a toggle or checkbox
Section titled “Filter from a toggle or checkbox”- Create a Boolean variable, such as
Is Customer. See Variables. - Add an input object, set its input type to Checkbox or Toggle, and choose the variable.
- Under Variable change: Is Customer, add if / else with Get Is Customer value as the condition. In the if branch, add Set filter with the values to show; in the else branch, add Clear Applied and pending filters for field.

Show an object after a selection in a table
Section titled “Show an object after a selection in a table”- Under Enter: sheet, add Set object container Visibility set to
false. - Under On field filter change within Pending state, for the field the table
filters on, add the same block set to
true. A selection in a table is pending until it is applied, so the object appears as soon as the viewer selects a row.

Copy filters between fields
Section titled “Copy filters between fields”When two fields hold the same values, such as a product ID in two related tables, you can keep their filters alike. Under On field A filter change within Applied state, add Set filter field B to with the values from Fetch dimension (as list) field B type All possible.

This copies the selection only when filtering field A narrows field B. If the tables are not related, read field A’s selected values instead.
Select the top N values
Section titled “Select the top N values”- Add a table with the field to select as its dimension and the ranking measure, and give it a
name you can find, such as
Top Customers. - In the table’s Data tab, turn on Show Top N dimension values. To let an action change
N, set it from a variable such as
TopN. See Show only the top or bottom N. - Under Before workbook opens, add Wait for object for the table, then For each item in Get export data from Top Customers. In the loop, add Append to filter field values with the row’s first value from get value at index 1 in item.

To select the values on demand, run the same blocks from a filter bar custom button. First add
Clear Applied and pending filters for field, so the previous top values do not stay
selected and do not narrow the table, then set TopN and wait for the table again. See
Run an action from a custom button.
Wait for object is more reliable than a fixed Wait seconds when queries are slow.
Get export data from is in the catalog only when Excel reporting is enabled for your account.
Show a sheet in more than one language
Section titled “Show a sheet in more than one language”- Create a translation table in your data source, with an ID column holding a variable name and one column per language.
- Create a String variable for each ID, and set your titles and labels from them with Text from variable.
- Add a filter bar custom button for each language, such as
ENandFR. - Under When Filter Bar emits On click do, check Custom button name, then loop over the translation table’s export data with For each. For each row, set the variable named in the ID column to the value in that language’s column.


Summarize a table with AI
Section titled “Summarize a table with AI”Under a trigger such as Enter: sheet, add Set variable to with the AI prompt block
as its value. Build its User prompt by joining your request, such as Provide a summary, to
Get export data from table. Show the variable in a text object with Text from variable.

To frame the answer for the reader, join Get Current User values, such as Name > Full Name, Role and Groups, into the System prompt, or into the Prompt additions (optional) of Generate AI insights. For both blocks, see Generate insights from an action.

Run custom SQL into a variable
Section titled “Run custom SQL into a variable”- Create a String variable with the SQL query sub-type. The query must return a single value.
It can include another variable’s value with
$(variable name). - Create a second variable for the result.
- Under a trigger such as Before workbook opens, add Set result variable to with Execute SQL SQL variable as its value.

See Variable types. To write data rather than read it, see Writeback.
Filters set by actions are not access control
Section titled “Filters set by actions are not access control”Filters and filter locks that actions set shape what a workbook shows; they do not stop a query returning other rows, and some viewers can unlock or change them. To restrict rows by who is asking, add a security rule to the semantic layer or use your data warehouse’s access control. For locking filters, see Lock a filter.
Start each viewer on their own scope
Section titled “Start each viewer on their own scope”Within that limit, actions can give each viewer a guided starting point, such as their own region:
- Keep a table that maps each user to their scope, such as a
Userstable with Email and Region columns. - In a procedure, set the
UsersEmail filter to Get Current User > Email, then set the Region filter to that user’s region. - Add Lock filter for both fields so viewers cannot change them in the filter bar.
- For a team that should see every region, test Get Current User > Groups or Role with if / else, and use Unlock filter and clear the Region filter instead.
- Run the procedure from Before workbook opens.

To keep viewers from clearing these filters, turn on Hide Clear all button and list the fields in Hide fields in the filter bar settings, then copy the settings to other sheets with Copy Filter Bar Settings. See Filters.
Related pages
Section titled “Related pages”- Action blocks for each block’s inputs and behaviour.
- Drill down automatically past a selection threshold.
- Run an action from a custom button in the filter bar.
- Switch a chart’s measure from a dropdown.