Skip to main content
All CollectionsBuild AutomationsVariables
Table Workspace Variables: Manage Data Efficiently in Torq
Table Workspace Variables: Manage Data Efficiently in Torq

Learn how to use table workspace variables in Torq for efficient data management.

Updated over a week ago

Use table workspace variables to conveniently manage data that is best presented in tabular form. These variables enable simple visualization and presentation of tables, enhancing the clarity and accessibility of your data. Easily automate processes to respond to table updates or update data in tables, further streamlining your work and increasing efficiency.

Creating a Table: Setting the Table Schema

  1. You can create tables both automatically and manually:

    1. Automatically:

      • Use the Create a workspace variable step:

        • Give the table variable a meaningful name. The programmatic name will be derived from the pretty name by converting it to lowercase, removing special characters, and replacing spaces with underscores.

        • Select table as the data type.

        • Specify the table columns (see step 2 below).

        • Specify a Torq integration to execute the step.

    2. Manually:

      1. Navigate to the Workspace Variables Page: Go to Build > Workspace Variables.

      2. Create a New Workspace Variable: Click the + icon in the Variables column and set the variable type to Table. Give the table variable a meaningful name.

  2. Define the Table Schema: Set the table schema by specifying the table columns. The table is created with these default columns:

    • id: The row index.

    • created_by: Indicates who created the row.

    • created_at: Indicates when the row was created.

    • updated_by: Indicates who updated the row.

    • updated_at: Indicates when the row was updated.

  • Column names must begin with a letter (a-z) or an underscore (_). Subsequent characters can be letters, digits (0-9), or underscores.

  • Some names are reserved because they are SQL keywords.

  • Cells support long text, boolean, number, or JSON formats.

  • Table workspace variables have the following guardrails for optimal performance and stability.

Working with tables

You can perform actions on tables both manually and automatically.

Automatic Actions

Use steps to operate on tables automatically:

  • Insert Into Table: Add new data entries.

  • Update Table: Modify existing data.

  • Delete From Table: Remove data entries.

  • Query Table: Utilize the step optional parameters to retrieve specific columns, sort data, and filter cells based on specified conditions.

  • Update a workspace variable: Update the table schema.

To run these steps, you need a Torq integration.

Manual Actions

In the Workspace Variables page, at the top right of the table preview, you can:

  • Add Rows: Insert new data into the table.

  • Modify the Table Schema: Add columns to expand the table structure.

  • Delete Rows: Remove unwanted data.

  • Revert Unsaved Changes: Undo any modifications that haven't been saved.

Example: Add User Information to a Table

In this example, we aim to collect user responses to a survey in a table format. To start, we'll populate the table with the users we want to survey. In this case, these are users who have been locked out of Okta.
The table schema is automatically populated when you select the table name.

Triggering Workflows Upon Table Updates

Use the System Events > Variable updated trigger to automate a response to table updates.

Example: Trigger a Workflow When a New Row Is Added

Create a workflow that's triggered whenever a new row is added to the table:

  1. Use the System Events > Variable updated trigger.

  2. Add trigger conditions to specify the table name and the exact type of update that will activate the workflow.

In this example, the new row contains the email address of the user to be surveyed.

3. The workflow will automatically send survey questions to the user.

4. The answers are recorded directly in the same table row, streamlining the data collection process.

Create and Manage Table Schemas with Workspace Variables API

The Workspace Variables API allows you to manage table schemas, including retrieving the existing column titles, creating new tables, and updating column details.

The API does not support accessing the table data itself.

Create a table

To create a table, send an API request using the following format:

curl --request POST \
--url https://api.torq.io/public/v1alpha/workspace_variables \
--header 'Authorization: Bearer REPLACE_BEARER_TOKEN' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{"pretty_name":"table_name","table":{"columns":[{"name":"col1","text":{}},{"name":"col2","boolean":{}}]}}'

Update a table

To update the table schema, send an API request using the following format:

curl --request PUT \
--url https://api.torq.io/public/v1alpha/workspace_variables/table_name \
--header 'Authorization: Bearer REPLACE_BEARER_TOKEN' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{ "variable":{"name":"table_name","table":{"columns":[{"name":"col1","text":{}}]}}}'
Did this answer your question?