> ## Documentation Index
> Fetch the complete documentation index at: https://docs.blinkops.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Using Tables in Workflows

> How to use Blink table actions in workflows to automate data management and record operations.

## Table Actions

Blink provides powerful workflow actions that allow you to automate the management of table records. These actions enable you to add, update, retrieve, and delete records dynamically within your workflows.

<Tip>
  All Table-related actions can be found under the **'Tables' collection** in the action panel of the [workflow editor](/docs/workflows/building-workflows/workflow-editor)
</Tip>

<Warning>Please note: **SQL** queries are supported only in the [Get Records](#get-a-record) action. **SQL** is **not supported** for other table-related actions, such as [Create Record or Update Record](#create-or-update-record).</Warning>

***

### Create Table from Data

<div className="integrations-table">
  | Parameter         | Description                                                                                                                                                                            |
  | ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
  | Table Name        | Specifies the name of the table to be created. This name will be used to identify and reference the table within the system.                                                           |
  | Data              | The structured data to populate the table, provided in valid JSON format. Each `JSON` object represents a row, and each `key-value` pair defines a column and its corresponding value. |
  | Add Data to Table | When enabled, the provided JSON data will be populated into the newly created table. If disabled, the table will be created without any initial data.                                  |
</div>

<Frame>
  <img src="https://mintcdn.com/blinkops-2/5M5OW3K40-ebWORZ/img/Tables/CreateTableFromData.png?fit=max&auto=format&n=5M5OW3K40-ebWORZ&q=85&s=ca668a03c1fe777f2ccc44179c013062" width="1163" height="399" data-path="img/Tables/CreateTableFromData.png" />
</Frame>

<Warning>
  **Important Limitations & Behavior**

  * **Large Text Handling**: Any text value exceeding `40KB` will automatically be stored as a **long-text** column type.

  * **Column Display Names**: The `JSON` key provided in each record is used directly as the column’s display name. For example, if you pass `user_name` as the key, the column will be created and displayed as `user_name`.

  * **Duplicate Column Names**: If a column name conflicts with an existing system column (e.g., `created_at`), a new column will still be created with a randomly generated suffix (e.g., `created_at_123`) to avoid overwriting the original column.

  * **Mixed Data Types**: If the same key contains different data types across records (for example, a number in one record and text in another), the column type will automatically fall back to text to accommodate all values.

  To avoid unexpected schema changes, ensure consistent key naming and data types across all records before submitting your JSON data.
</Warning>

***

### Add a Record

Add new records to a table by entering field names and values or by providing data in `JSON` format.`JSON` input supports bulk creation, allowing multiple records to be added simultaneously in a single action.

<Tip> You can also use the [Variable Picker](/docs/workflows/building-workflows/dynamic-variables/variable-picker) to easily insert [dynamic variables](/docs/workflows/building-workflows/dynamic-variables/variable-picker#dynamic-variables-types) into the 'Add Record' action's input fields. </Tip>

<Tabs>
  <Tab title="Typed-in Values">
    Add a record to a table by entering the table field name and the table field value.

    <div className="integrations-table">
      | Parameter | Description                                           |
      | --------- | ----------------------------------------------------- |
      | Table     | The name of the table.                                |
      | Record    | Data of record, enter the field name and field value. |
    </div>

    <Frame>
      <img src="https://mintcdn.com/blinkops-2/ZA3cU0qNFQK5NU_S/img/Tables/AddRecord.png?fit=max&auto=format&n=ZA3cU0qNFQK5NU_S&q=85&s=5b1ad388b579515c8d7e89658f357e12" width="3198" height="1059" data-path="img/Tables/AddRecord.png" />
    </Frame>
  </Tab>

  <Tab title="JSON Format">
    Records can be added by inputting values in JSON format. Bulk creation is also supported, allowing the input of a list of JSON objects.

    <div className="integrations-table">
      | Parameter | Description                                                                                         |
      | --------- | --------------------------------------------------------------------------------------------------- |
      | Table     | The name of the table.                                                                              |
      | Record    | Data of record, a JSON format containing `Key : Value` pairs. Can also be a list of `JSON` objects. |
    </div>

    <Frame>
      <img src="https://mintcdn.com/blinkops-2/ZA3cU0qNFQK5NU_S/img/Tables/AddRecordJson.png?fit=max&auto=format&n=ZA3cU0qNFQK5NU_S&q=85&s=fbe10de14dfdb92ddd26784a56ac04a6" width="2895" height="937" data-path="img/Tables/AddRecordJson.png" />
    </Frame>
  </Tab>
</Tabs>

***

### Create or Update Record

Ensure data consistency by either updating an **existing record** or creating a new one if no match is found. You can define specific conditions to determine whether a record should be updated or newly inserted. Supports both direct value input and JSON formatting for structured updates.

<Tabs>
  <Tab title="Entire Record">
    Create or Update an entire Record in a table by selecting the entire record option.

    <Note>**Note:** Please note that if you leave any fields empty in the **Create or Update Record** action, the existing values in the table will remain unchanged.</Note>

    <div className="integrations-table">
      | Parameter                  | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
      | -------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
      | Table                      | The name of the table.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
      | Create or Update Condition | Define the criteria that determine whether a table record should be created or updated. You can also use [nested conditions](/docs/blink-platform/condition-builder/condition-builder#the-advanced-condition-builder-and-nested-conditions), groups of conditions within other conditions, to build more complex rules for your table data. [nested conditions](/docs/blink-platform/condition-builder/condition-builder#the-advanced-condition-builder-and-nested-conditions) let you apply operators like AND or OR to a specific subset of conditions independently from the main group, giving you precise control over how your table records are filtered and evaluated |
      | Record Data Format         | Entire Record                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
      | Record                     | The value of the record you want to create or update                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
    </div>

    <AccordionGroup>
      <Accordion title="Use Case Example: Ensuring Accurate Privileged User Access Tracking" icon="circle-1">
        **Scenario:** You need to track users with privileged access in a security system. If a user is added to the list of privileged users, you want to update their access record; if the user is already on the list, their record should be updated instead of adding a duplicate.

        **Solution:** Use the Create or Update Records action to ensure that any changes to a privileged user’s access rights are properly reflected in the table without creating duplicate record.

        In the 'Create or Update Records' action, a condition to check for users who already have access listed in the table.

        * If the user is not found (i.e., their record does not exist), create a new record with their user ID, access level, and timestamp.
        * If the user’s record already exists, update the record with the new access level or other relevant information.

        <Frame>
          <img src="https://mintcdn.com/blinkops-2/ZA3cU0qNFQK5NU_S/img/Tables/CreateOrUpdateRecord.png?fit=max&auto=format&n=ZA3cU0qNFQK5NU_S&q=85&s=c71e9ca0778884374aa47282d4a75fff" width="1163" height="397" data-path="img/Tables/CreateOrUpdateRecord.png" />
        </Frame>
      </Accordion>

      <Accordion title="Use Case Example: Tracking Failed Login Attempts for Users" icon="circle-2">
        **Scenario:** You are building a system to monitor user login attempts. If a user fails to log in multiple times within a short period, you want to flag their account as potentially compromised, but you don’t want to duplicate records for each failed attempt.

        **Solution:** Use the Create or Update Records action to update the record for failed login attempts instead of creating a new record for every failure.

        Set a condition in the Create or Update Records action to check if the user already has a record of failed login attempts.

        * If a failed login attempt is detected and the user has a record, update the record by incrementing the failed attempt counter and updating the timestamp.
        * If no record exists for the user’s failed attempt, create a new record with the user’s details and an initial failed attempt count.

        <Frame>
          <img src="https://mintcdn.com/blinkops-2/ZA3cU0qNFQK5NU_S/img/Tables/CreateOrUpdateRecord2.png?fit=max&auto=format&n=ZA3cU0qNFQK5NU_S&q=85&s=9abd6ff4eefcbfd112307d4c05aa5e56" width="1162" height="397" data-path="img/Tables/CreateOrUpdateRecord2.png" />
        </Frame>
      </Accordion>
    </AccordionGroup>
  </Tab>

  <Tab title="JSON Format">
    Create or Update a Record in a table by entering values in JSON format.

    <Note>
      **Note:**
      Please note that if you leave any fields empty in the **Create or Update Record** action, the existing values in the table will remain unchanged.
    </Note>

    <div className="integrations-table">
      | Parameter                  | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
      | -------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
      | Table                      | The name of the table.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
      | Create or Update Condition | Define the criteria that determine whether a table record should be created or updated. You can also use [nested conditions](/docs/blink-platform/condition-builder/condition-builder#the-advanced-condition-builder-and-nested-conditions), groups of conditions within other conditions, to build more complex rules for your table data. [nested conditions](/docs/blink-platform/condition-builder/condition-builder#the-advanced-condition-builder-and-nested-conditions) let you apply operators like AND or OR to a specific subset of conditions independently from the main group, giving you precise control over how your table records are filtered and evaluated |
      | Record Data Format         | JSON                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
      | Record                     | The value of the record you want to create or update in JSON format                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
    </div>

    <Accordion title="Use Case Example (JSON Format): Tracking Failed Login Attempts for Users" icon="circle-1">
      **Scenario:** A security system monitors unauthorized attempts to access sensitive files. When a user repeatedly tries to access a restricted file, the system should update the record for that file access attempt with the latest timestamp and IP address, rather than creating multiple entries.

      **Solution:** Use the Create or Update Records action to track unauthorized file access attempts. The action checks if a record exists for a specific combination of user and file; if it does, it updates the record with the latest timestamp and IP address. If no matching record is found, a new record is created.

      * If a record exists where the `Name` and the `FileID` value matches the requested file, the system will update the record with the latest timestamp and IP address.
      * If no match is found, it will create a new record for that combination.

      <Frame>
        <img src="https://mintcdn.com/blinkops-2/ZA3cU0qNFQK5NU_S/img/Tables/JSONExample.png?fit=max&auto=format&n=ZA3cU0qNFQK5NU_S&q=85&s=1a5eab98bdd37f02475d063e238b3f27" width="1159" height="395" data-path="img/Tables/JSONExample.png" />
      </Frame>
    </Accordion>
  </Tab>

  <Tab title="By Field">
    Create or update specific records in a table by selecting a particular field to determine which records should be modified.

    <div className="integrations-table">
      | Parameter                  | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
      | -------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
      | Table                      | The name of the table.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
      | Create or Update Condition | Define the criteria that determine whether a table record should be created or updated. You can also use [nested conditions](/docs/blink-platform/condition-builder/condition-builder#the-advanced-condition-builder-and-nested-conditions), groups of conditions within other conditions, to build more complex rules for your table data. [nested conditions](/docs/blink-platform/condition-builder/condition-builder#the-advanced-condition-builder-and-nested-conditions) let you apply operators like AND or OR to a specific subset of conditions independently from the main group, giving you precise control over how your table records are filtered and evaluated |
      | Record Data Format         | By Field                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
      | Record By Field            | Decide which records in the fields will be updated. If a new record is created, all fields not selected will set their default value.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
    </div>

    <Accordion title="Use Case Example: Monitor and Timestamp Failed Logins" icon="circle-1">
      **Scenario**: A company's security team is monitoring user login activity to detect suspicious behavior. When a user experiences a failed login attempt, the system should capture and update the timestamp of that failure. This helps in identifying patterns of unauthorized access without cluttering the database with redundant entries.

      **Solution**: Use the Create or Update Record action to ensure that only the latest failed login attempt is recorded for each user.

      * If a match is found: The system updates the existing record's **timestamp field** to reflect the time the most recent failed login attempt.

      * If no match is found: The system creates a new record for that failed login event.

      <Frame>
        <img src="https://mintcdn.com/blinkops-2/ZA3cU0qNFQK5NU_S/img/Tables/ByField.png?fit=max&auto=format&n=ZA3cU0qNFQK5NU_S&q=85&s=413def8892110ef4707eb4c78f12defa" width="1155" height="397" data-path="img/Tables/ByField.png" />
      </Frame>
    </Accordion>
  </Tab>
</Tabs>

***

#### "Add Records" Action vs. "Create or Update Records" Action

When adding data to a table, choosing the right action ensures accuracy and prevents duplication. Use **"Add Records"** when you need to insert new data without verifying existing entries. If you want to update existing records or avoid duplicates, **"Create or Update Records"** is the better choice, as it checks for a match before adding new data. The table below outlines the key differences between these actions.

<div className="integrations-table">
  | Action                                              | Behavior                                                                                    | Key Difference                                                            |
  | --------------------------------------------------- | ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- |
  | [Add Record](#add-a-record)                         | When you need to insert new data without checking for existing records                      | Adds records without checking for duplicates                              |
  | [Create or Update Record](#create-or-update-record) | When you want to prevent duplicates or update existing records based on specific conditions | Checks for a matching record before adding; updates if found, adds if not |
</div>

<Tip>
  You can manually set certain field types (`Text`, `Numbers`, `Users`, `Time`) as unique in the table. This ensures that each entry in a specific column is distinct, preventing duplicate values. For more details, visit [this guide](/docs/blink-platform/tables/create-your-first-table#table-field-types-with-unique-values).
</Tip>

***

### Update Records (In Bulk)

This action allows you to update multiple records in a table in a single operation.

<div className="integrations-table">
  | Parameter   | Description                                                                                                                                                                                                                                      |
  | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
  | **Table**   | The table in which you want to update multiple records.                                                                                                                                                                                          |
  | **Records** | Provide a `JSON` array containing the records to update. Each object **must** include the record `id` and the multiple fields you want to update. All records in the array should follow the same structure and include the same set of columns. |
</div>

<Frame>
  <img src="https://mintcdn.com/blinkops-2/4xKda8XtrnGronvM/img/Tables/UpdateBulkRecords.png?fit=max&auto=format&n=4xKda8XtrnGronvM&q=85&s=bedaa96ba9bc3a35d8dfbe1b97beec1e" width="2327" height="784" data-path="img/Tables/UpdateBulkRecords.png" />
</Frame>

<Warning>
  **Please Note:**

  * All records in the array must follow the same structure and include the same set of columns.
  * `Reference` and `Files` field types are **not allowed** for updates.
  * The `Records` input is limited to **1,000** per operation
</Warning>

***

## Update File Column

The 'Update File Column' action updates the file stored in a table’s file column.

<div className="integrations-table">
  | Parameter                                                                                                   | Description                                                                       |
  | ----------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- |
  | Table Name                                                                                                  | The name of the table from which the record will be unlinked from another record. |
  | Record ID                                                                                                   | The ID of the record to update                                                    |
  | File Column                                                                                                 | The name of the file column                                                       |
  | [File Identifier](/docs/workflows/building-workflows/files#expression-language-and-variable-picker-support) | The identifier of the file. Leave empty to clear the file column                  |
</div>

<Frame>
  <img src="https://mintcdn.com/blinkops-2/rqwIyd1pUgKGoXeK/img/Tables/UpdateFileColumn.png?fit=max&auto=format&n=rqwIyd1pUgKGoXeK&q=85&s=81e73427ecc65d7980ed2afcabf83696" width="2320" height="794" data-path="img/Tables/UpdateFileColumn.png" />
</Frame>

***

### Get a Record

Fetch table data based on specified criteria using conditions, RQL queries, or SQL queries. Choose how the data is structured in the output (Table, JSON, or CSV) and refine results by applying filters, sorting, limits, and pagination options.

<Accordion title="Tip: When to Use Each Query Method" icon="lightbulb">
  Each query method is designed for different use cases, depending on the complexity of your query and the level of filtering or customization required. Here are our recommendations on when to use each query method.

  #### **By Condition**

  **Best For: Simple Queries with Basic Filtering**

  * Use this method when you need to retrieve records based on straightforward conditions, such as **checking if a user has a specific access level** or **finding all records created after a certain date**.
  * Conditions are easy to configure without needing complex query syntax.

  **Use Case Example:**

  * Retrieve all users with `AccessLevel = "Administrator"` to audit privileged accounts.

  ***

  #### **RQL Format**

  **Best For: Flexible Queries with Advanced Filtering**

  * Use RQL when you need more precise filtering with operators like `$gte`, `$lte`, `$contains_any`, or `$like`.
  * Ideal for dynamic queries where conditions may change based on user input or external events.

  **Use Case Example:**

  * Fetch all users who have accessed the system **in the past 24 hours**:
    ```json theme={"dark"}
    {
      "filter": {
        "Timestamp": { "$gt": "{{ to_epoch(now() - '24h') * 1000 }}" }
      }
    }
    ```
  * Retrieve all users with an **AccessLevel of "Administrator" or "Manager"**:
    ```json theme={"dark"}
    {
      "filter": {
        "AccessLevel": { "$contains_any": ["Administrator", "Manager"] }
      }
    }
    ```

  ***

  #### **SQL Query**

  **Best For: Complex Queries, Joins, and Aggregations**

  * Use SQL when you need to perform **multi-table joins, grouping, aggregation, or subqueries**.
  * Ideal for reporting and analytics, such as tracking security incidents over time.

  **Use Case Example:**

  * **Detect Privilege Escalation Attempts** by finding users who had an access level change in the last 7 days:
    ```sql theme={"dark"}
    SELECT UserID, AccessLevel, Timestamp
    FROM PrivilegedUserAccess
    WHERE Timestamp >= NOW() - INTERVAL '7 days'
    ORDER BY Timestamp DESC;
    ```
  * **Cross-reference users with recent failed login attempts**:
    ```sql theme={"dark"}
    SELECT u.UserID, u.AccessLevel, f.FailedAttempts
    FROM PrivilegedUserAccess u
    JOIN FailedLogins f ON u.UserID = f.UserID
    WHERE f.Timestamp >= NOW() - INTERVAL '1 day'
    ```
</Accordion>

<Tabs>
  <Tab title="By Condition">
    Get a Record from a table by using a `condition`. All records that match the condition will be returned.

    <Accordion title="By Condition- Exception Rule" icon="circle-exclamation">
      When querying a table using a condition, and you are using both the `in` operator, it is essential to use the `arr() function` when working with arrays. Failing to do so will cause the workflow action to fail.

      **For Example**:

      <Frame>
        <img src="https://mintcdn.com/blinkops-2/Xl5NRWST4bMFSw1T/img/Tables/InOperatorException.png?fit=max&auto=format&n=Xl5NRWST4bMFSw1T&q=85&s=e41d90f74a278055a9d76bdef55d648e" width="799" height="275" data-path="img/Tables/InOperatorException.png" />
      </Frame>
    </Accordion>

    <div className="integrations-table">
      | Parameter                                   | Description                                                                                                                                                                                                                                                                                                                                                                                                              |
      | ------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
      | Query Method                                | **By Condition**- The query method to get records                                                                                                                                                                                                                                                                                                                                                                        |
      | Table                                       | The table you want to get records from.                                                                                                                                                                                                                                                                                                                                                                                  |
      | Fields                                      | [Table Fields](/docs/blink-platform/tables/create-your-first-table#table-field-types).                                                                                                                                                                                                                                                                                                                                   |
      | Condition                                   | Condition that compares two table field values – Use this condition to compare the values of two fields in a table. You can also include [nested conditions](/docs/blink-platform/condition-builder/condition-builder#the-advanced-condition-builder-and-nested-conditions) to compare multiple values or sets of fields, allowing you to build more complex rules and control exactly how your table data is evaluated. |
      | Output Format                               | The format of the output the records are returned- Table, JSON or CSV .                                                                                                                                                                                                                                                                                                                                                  |
      | Limit (optional)                            | Limit the amount of records returned by the query.                                                                                                                                                                                                                                                                                                                                                                       |
      | Offset (optional)                           | Choose the offset from the data to start querying the table from.                                                                                                                                                                                                                                                                                                                                                        |
      | Order By (optional)                         | Choose what field to order the results by.                                                                                                                                                                                                                                                                                                                                                                               |
      | Sort (optional)                             | Sort the records by ascending or descending order.                                                                                                                                                                                                                                                                                                                                                                       |
      | Include Query Metadata In Output (optional) | Check the box to include Query Metadata in the Output.                                                                                                                                                                                                                                                                                                                                                                   |
      | All Pages (optional)                        | Check the box to return all data in the table(this setting invalidates the `Limit` and `Offset` fields.)                                                                                                                                                                                                                                                                                                                 |
    </div>

    <Accordion title="Use Case Example: Get Table Records According to a Specified Condition." icon="circle-1">
      The action retrieves specific records from the "User Data" table using the "By Condition" method, selecting fields like Created At, Updated At, and more, while filtering for users with an Access Level of "Contributor."
    </Accordion>

    <Frame>
      <img src="https://mintcdn.com/blinkops-2/ZA3cU0qNFQK5NU_S/img/Tables/GetRecordsExample.png?fit=max&auto=format&n=ZA3cU0qNFQK5NU_S&q=85&s=90cb7d2e5405397b81c92cf81f567947" width="1157" height="396" data-path="img/Tables/GetRecordsExample.png" />
    </Frame>
  </Tab>

  <Tab title="RQL Format">
    `Get Record(s)` by querying a table for records using the `RQL` query method.

    <div className="integrations-table">
      | Parameter                                   | Description                                                                                                                                                                                                                                                                                                                                                                                                              |
      | ------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
      | Query Method                                | **RQL Format**- The query method to get records                                                                                                                                                                                                                                                                                                                                                                          |
      | Table                                       | The table you want to get records from.                                                                                                                                                                                                                                                                                                                                                                                  |
      | RQL Query                                   | The RQL query to run against the table.                                                                                                                                                                                                                                                                                                                                                                                  |
      | Condition                                   | Condition that compares two table field values – Use this condition to compare the values of two fields in a table. You can also include [nested conditions](/docs/blink-platform/condition-builder/condition-builder#the-advanced-condition-builder-and-nested-conditions) to compare multiple values or sets of fields, allowing you to build more complex rules and control exactly how your table data is evaluated. |
      | Output Format                               | The format of the output the records are returned- Table, JSON or CSV .                                                                                                                                                                                                                                                                                                                                                  |
      | Limit (optional)                            | Limit the amount of records returned by the query.                                                                                                                                                                                                                                                                                                                                                                       |
      | Offset (optional)                           | Choose the offset from the data to start querying the table from.                                                                                                                                                                                                                                                                                                                                                        |
      | Include Query Metadata In Output (optional) | Check the box to include Query Metadata in the Output.                                                                                                                                                                                                                                                                                                                                                                   |
      | All Pages (optional)                        | Check the box to return all data in the table(this setting invalidates the `Limit` and `Offset` fields.)                                                                                                                                                                                                                                                                                                                 |
    </div>

    * Get a Record by using RQL format lets you query a table for record(s) using the `Select`, `Filter`, or `Sort` actions on the tables' collection.

      * **Select** - Specify which fields to return by specifying fields name using the **Select** option.
      * **Filter** - Specify which records to return using the **Filter** option - only records where the `Is Admin` value is false.
      * **Sort** - Define the sorting criteria by designating the relevant field and order. For ascending order, use `+` before the field name; for descending order, use `-` instead. For Example: `"sort": [+"updated_at"]`

    <Accordion title="RQL Format Example" icon="up-down">
      ```jsx theme={"dark"}
      {
      	"select": [] // list of fields to select.
      	"limit": 100 // limit the amount of records that will return (max is 1000).
      	"offset": 0 // the offset from where to return the data.
        "sort": [+"updated_at"] // In this example we are sorting the "updated_at" value in ascending order as there is a + before the field value.
      	"filter": {
      		key: value // this option lets you filter a specific key with its value
      		// for example "name": "Public"
      		key: {
      			"$gt", "$gte", "$lt", "$lte",
      			"$contains_any", "$contains_all", "$like": value
      			// this options lets you do more advanced filtering, for example checking
      			// if a record was created in the past 25 minutes.
      			// "$gt": {{ to_epoch(now() - '25m') * 1000 }}
      		}
      	}
      }
      ```
    </Accordion>

    <Frame>
      <img src="https://mintcdn.com/blinkops-2/ZA3cU0qNFQK5NU_S/img/Tables/GetRecordsRql.png?fit=max&auto=format&n=ZA3cU0qNFQK5NU_S&q=85&s=14ad7cfeb15e6342923d0c65b980ff81" width="2413" height="792" data-path="img/Tables/GetRecordsRql.png" />
    </Frame>
  </Tab>

  <Tab title="SQL Query">
    `Get Record(s)` by querying a table for records using the `SQL` query method.

    <div className="integrations-table">
      | Parameter                                   | Description                                                                                                                                                                                                                                                                                                                                                                                                              |
      | ------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
      | Query Method                                | **SQL Format** The query method to get records                                                                                                                                                                                                                                                                                                                                                                           |
      | Table                                       | The table you want to get records from.                                                                                                                                                                                                                                                                                                                                                                                  |
      | SQL Query                                   | The SQL query to run against the table.                                                                                                                                                                                                                                                                                                                                                                                  |
      | Condition                                   | Condition that compares two table field values – Use this condition to compare the values of two fields in a table. You can also include [nested conditions](/docs/blink-platform/condition-builder/condition-builder#the-advanced-condition-builder-and-nested-conditions) to compare multiple values or sets of fields, allowing you to build more complex rules and control exactly how your table data is evaluated. |
      | Output Format                               | The format of the output the records are returned- Table, JSON or CSV .                                                                                                                                                                                                                                                                                                                                                  |
      | Limit (optional)                            | Limit the amount of records returned by the query.                                                                                                                                                                                                                                                                                                                                                                       |
      | Offset (optional)                           | Choose the offset from the data to start querying the table from.                                                                                                                                                                                                                                                                                                                                                        |
      | Include Query Metadata In Output (optional) | Check the box to include Query Metadata in the Output.                                                                                                                                                                                                                                                                                                                                                                   |
      | All Pages (optional)                        | Check the box to return all data in the table(this setting invalidates the `Limit` and `Offset` fields.)                                                                                                                                                                                                                                                                                                                 |
    </div>

    **SQL Format Example:**

    ```sql theme={"dark"}
    select
       table_1.number as t1_num,
       table_2.number as t2_num
    from
       table_1
    left outer join
       table_2
    on
     table_1.name = table_2.name
    ```

    <Frame>
      <img src="https://mintcdn.com/blinkops-2/gXVhdwN-st8--W_M/img/Tables/SqlAction.png?fit=max&auto=format&n=gXVhdwN-st8--W_M&q=85&s=9e53831e6987ded8a8882aec5810feb5" width="1754" height="772" data-path="img/Tables/SqlAction.png" />
    </Frame>
  </Tab>
</Tabs>

***

### Delete a Record

Remove specific records from a table by referencing their unique `ID` or by setting a condition to delete multiple records that meet certain criteria. This ensures precise control over data removal while preventing accidental deletions.

<Tabs>
  <Tab title="Record ID">
    Deletes a record from a table by the `Record ID`.

    <div className="integrations-table">
      | Parameter  | Description                                                                                           |
      | ---------- | ----------------------------------------------------------------------------------------------------- |
      | Table Name | The name of the table.                                                                                |
      | Record ID  | The record unique identifier. Can be obtained via the [Select](#query-a-table-select-records) action. |
    </div>

    <Frame>
      <img src="https://mintcdn.com/blinkops-2/ZA3cU0qNFQK5NU_S/img/Tables/DeleteRecordId.png?fit=max&auto=format&n=ZA3cU0qNFQK5NU_S&q=85&s=a23d866e5a2b56b2111635cdda168921" width="3044" height="1006" data-path="img/Tables/DeleteRecordId.png" />
    </Frame>
  </Tab>

  <Tab title="Conditional Statements">
    Deletes a record or multiple records from a table only when a certain `condition` is met.

    <div className="integrations-table">
      | Parameter            | Description                                                                                                                                                                                                                                                                                                                                                                                                              |
      | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
      | Table Name           | The name of the table.                                                                                                                                                                                                                                                                                                                                                                                                   |
      | Condition (Optional) | Condition that compares two table field values – Use this condition to compare the values of two fields in a table. You can also include [nested conditions](/docs/blink-platform/condition-builder/condition-builder#the-advanced-condition-builder-and-nested-conditions) to compare multiple values or sets of fields, allowing you to build more complex rules and control exactly how your table data is evaluated. |
    </div>

    <Frame>
      <img src="https://mintcdn.com/blinkops-2/ZA3cU0qNFQK5NU_S/img/Tables/DeleteRecord.png?fit=max&auto=format&n=ZA3cU0qNFQK5NU_S&q=85&s=bd63bade9676ec3a8942c7f82ae8c94c" width="2410" height="782" data-path="img/Tables/DeleteRecord.png" />
    </Frame>
  </Tab>
</Tabs>

***

## Managing [Tables](/docs/blink-platform/tables/tables) with Workflow Actions

Blink provides powerful workflow actions that allow you to automate the management of [tables](/docs/blink-platform/tables/tables). These actions enable you to create, clear, retrieve, copy and delete tables dynamically within your workflows.

***

### Create a Table

Create a table based on a schema.

<div className="integrations-table">
  | Parameter      | Description                                                                                                           |
  | -------------- | --------------------------------------------------------------------------------------------------------------------- |
  | Table Name     | The name of the table.                                                                                                |
  | Table Schema   | The schema of the table in `JSON` format.<br />For more information, see the [Copy table schema](#copy-table-schema). |
  | Skip if Exists | Skips table creation if a table with the same name already exists.                                                    |
</div>

<Frame>
  <img src="https://mintcdn.com/blinkops-2/ZA3cU0qNFQK5NU_S/img/Tables/CreateTable.png?fit=max&auto=format&n=ZA3cU0qNFQK5NU_S&q=85&s=cc2d49c79ae629199347c281bcecec32" width="2673" height="872" data-path="img/Tables/CreateTable.png" />
</Frame>

***

### Copy Table Schema

For each table that is created, there is a table schema.

<Accordion title="Learn how to Copy a Table's Schema">
  Click the 3 dots menu of the table > **Copy table scheme**.

  <Frame>
    <img src="https://mintcdn.com/blinkops-2/gXVhdwN-st8--W_M/img/Tables/copy-schema-table-btn.png?fit=max&auto=format&n=gXVhdwN-st8--W_M&q=85&s=e7494c45281da5abcb24dbdd11d4de21" width="1728" height="1074" data-path="img/Tables/copy-schema-table-btn.png" />
  </Frame>
</Accordion>

<Accordion title="Click Here to View the Whole Table Schema" icon="up-down">
  **Example of a Table Schema:**

  ```json theme={"dark"}
  {
    "fields": [
      {
        "display_name": "Date",
        "description": "",
        "type": "date",
        "attributes": {
          "hidden": false,
          "include_time": false,
          "options": [],
          "required": false,
          "width": 165
        }
      },
      {
        "display_name": "Action",
        "description": "",
        "type": "text",
        "attributes": {
          "hidden": false,
          "options": [],
          "required": false,
          "width": 165
        }
      },
      {
        "display_name": "User",
        "description": "",
        "type": "user",
        "attributes": {
          "hidden": false,
          "options": [],
          "required": false,
          "width": 165
        }
      }
    ]
  }
  ```
</Accordion>

***

### Does Table Exist

Check if a table with a given display name exists.

<Tip>
  When using the [Create Table](#create-a-table) action, and the chosen name of a table already exists, the [Create Table](#create-a-table) action will fail.
  In order to prevent this scenario, you are recommended to use the `Does Table Exist` Action before the [Create Table](#create-a-table) step.
</Tip>

<div className="integrations-table">
  | Parameter  | Description                                                          |
  | ---------- | -------------------------------------------------------------------- |
  | Table Name | The name of the table.                                               |
  | Search By  | Search by `name`, `display name` or both. Default is `display name`. |
</div>

<Accordion title="Use Case Example: Creating a Table Only If Table Name Doesn’t Already Exist">
  Before creating a new table, it is important to check whether a table with the same name already exists to avoid failures.

  * If the table name already exists, the workflow will fail.

  <Frame>
    <img src="https://mintcdn.com/blinkops-2/gXVhdwN-st8--W_M/img/Tables/TableNameExists.png?fit=max&auto=format&n=gXVhdwN-st8--W_M&q=85&s=d3c0cddb0539517532f31e5bc0483b88" width="1728" height="1083" data-path="img/Tables/TableNameExists.png" />
  </Frame>

  * If the table name does not exist, a new table will be created successfully.

  <Frame>
    <img src="https://mintcdn.com/blinkops-2/gXVhdwN-st8--W_M/img/Tables/TableNameDoesntExist.png?fit=max&auto=format&n=gXVhdwN-st8--W_M&q=85&s=660974c3dbd799be6a73fd6525bb1351" width="1727" height="1080" data-path="img/Tables/TableNameDoesntExist.png" />
  </Frame>
</Accordion>

***

### Clear a Table

Clear all table records.

<div className="integrations-table">
  | Parameter  | Description            |
  | ---------- | ---------------------- |
  | Table Name | The name of the table. |
</div>

<Frame>
  <img src="https://mintcdn.com/blinkops-2/ZA3cU0qNFQK5NU_S/img/Tables/ClearTable.png?fit=max&auto=format&n=ZA3cU0qNFQK5NU_S&q=85&s=8a5bd242f9eb6f36449e6845b6ef3f18" width="2406" height="794" data-path="img/Tables/ClearTable.png" />
</Frame>

***

### Delete a Table

Deletes the entire table.

<div className="integrations-table">
  | Parameter  | Description            |
  | ---------- | ---------------------- |
  | Table Name | The name of the table. |
</div>

<Frame>
  <img src="https://mintcdn.com/blinkops-2/ZA3cU0qNFQK5NU_S/img/Tables/DeleteTable.png?fit=max&auto=format&n=ZA3cU0qNFQK5NU_S&q=85&s=cad60b7592d9f496570566671caa0aa5" width="2395" height="794" data-path="img/Tables/DeleteTable.png" />
</Frame>

***

## Event-Based Triggers for Table Events

### New Table Record

The **New Table Record** option is an [Event-Based Trigger](/docs/workflows/building-workflows/triggers/event-based-triggers/event-based-triggers) event that executes the workflow every time a **new record** is added to the selected table.

### Table Record Updated

The **Table Record Updated** option is an [Event-Based Trigger](/docs/workflows/building-workflows/triggers/event-based-triggers/event-based-triggers) event that executes the workflow every time a record in the selected table is **updated**.

<Warning>Make sure the **"Table Name"** in the trigger setup exactly matches the name of your table. Even small differences, like extra spaces or capitalization, can cause the trigger to fail.</Warning>

<Frame>
  <img src="https://mintcdn.com/blinkops-2/gXVhdwN-st8--W_M/img/Tables/Table-5.png?fit=max&auto=format&n=gXVhdwN-st8--W_M&q=85&s=49162436185beea21f83e78a919773b1" width="2237" height="1291" data-path="img/Tables/Table-5.png" />
</Frame>

***

## Related Articles

<CardGroup>
  <Card title="Tables" icon="table" iconType="solid" href="/docs/blink-platform/tables/tables">
    Learn more about tables in the Blink Platform
  </Card>

  <Card title="Using Tables in Workflows" icon="network-wired" iconType="solid" href="/docs/blink-platform/tables/tables-in-workflows">
    Learn more about creating and using table actions in Workflows
  </Card>

  <Card title="Basic Table Operations" icon="briefcase" iconType="solid" href="/docs/blink-platform/tables/tables-basic-operations">
    Learn more about basic table operations
  </Card>

  <Card title="Viewing Tables" icon="eye" iconType="solid" href="/docs/blink-platform/tables/viewing-tables">
    Learn more about filtering, sorting, ordering and browsing the table records
  </Card>
</CardGroup>
