> For the complete documentation index, see [llms.txt](https://docs.agenticflow.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.agenticflow.ai/reference/nodes/update_data.md).

# Update Data

**Action ID:** `update_dataset_rows`

## Description

Update rows in a dataset that match filter conditions.

## Input Parameters

| Name       | Type     | Required | Default | Description                                                                            |
| ---------- | -------- | :------: | ------- | -------------------------------------------------------------------------------------- |
| dataset    | dropdown |     ✓    | -       | The dataset to update rows in.                                                         |
| conditions | array    |     -    | \[]     | Filter conditions to select rows to update (empty = update all rows).                  |
| logic      | dropdown |     -    | and     | How to combine filter conditions (AND/OR). Options: and, or                            |
| updates    | object   |     ✓    | -       | Column name to new value mappings (e.g., {'status': 'completed', 'priority': 'high'}). |

### Filter Condition Structure

Each condition in the `conditions` array contains:

| Field    | Type     | Description                                                                               |
| -------- | -------- | ----------------------------------------------------------------------------------------- |
| column   | string   | Column name to filter by                                                                  |
| operator | dropdown | Comparison operator: equals, not\_equals, contains, greater\_than, less\_than, in         |
| value    | string   | Value to compare against. For 'in' operator, provide comma-separated values or JSON array |

<details>

<summary>View JSON Schema</summary>

```json
{
  "description": "Update Dataset Rows node input.",
  "properties": {
    "dataset": {
      "description": "The dataset to update rows in.",
      "title": "Dataset",
      "type": "string"
    },
    "conditions": {
      "default": [],
      "description": "Filter conditions to select rows to update (empty = update all rows).",
      "items": {
        "properties": {
          "column": {
            "description": "Column name to filter by",
            "title": "Column",
            "type": "string"
          },
          "operator": {
            "default": "equals",
            "description": "Comparison operator",
            "enum": ["equals", "not_equals", "contains", "greater_than", "less_than", "in"],
            "title": "Operator",
            "type": "string"
          },
          "value": {
            "description": "Value to compare against. For 'in' operator, provide comma-separated values or JSON array",
            "title": "Value",
            "type": "string"
          }
        },
        "required": ["column", "value"],
        "type": "object"
      },
      "title": "Filter Conditions",
      "type": "array"
    },
    "logic": {
      "default": "and",
      "description": "How to combine filter conditions (AND/OR).",
      "enum": ["and", "or"],
      "title": "Logic Operator",
      "type": "string"
    },
    "updates": {
      "description": "Column name to new value mappings (e.g., {'status': 'completed', 'priority': 'high'}).",
      "title": "Column Updates",
      "type": "object"
    }
  },
  "required": ["dataset", "updates"],
  "title": "UpdateDatasetRowsNodeInput",
  "type": "object"
}
```

</details>

## Output Parameters

| Name           | Type    | Description                             |
| -------------- | ------- | --------------------------------------- |
| updated\_count | integer | Number of rows that were updated.       |
| success        | boolean | Whether the update operation succeeded. |

<details>

<summary>View JSON Schema</summary>

```json
{
  "description": "Update Dataset Rows node output.",
  "properties": {
    "updated_count": {
      "description": "Number of rows that were updated.",
      "title": "Updated Count",
      "type": "integer"
    },
    "success": {
      "description": "Whether the update operation succeeded.",
      "title": "Success",
      "type": "boolean"
    }
  },
  "required": ["updated_count", "success"],
  "title": "UpdateDatasetRowsNodeOutput",
  "type": "object"
}
```

</details>

## How It Works

This node updates rows in a dataset based on filter conditions. It first identifies rows that match the specified conditions using the chosen logic operator (AND/OR), then applies the updates defined in the updates object. The node validates the dataset ID format (26-character ULID) before execution. All matching rows have their specified columns updated with new values, and the node returns the count of updated rows along with a success status.

## Usage Examples

### Example 1: Update User Status

**Input:**

```
dataset: "01K8ZM9T72FNBZAGA629KZFXR5"
conditions: [
  {
    "column": "email",
    "operator": "equals",
    "value": "alice@example.com"
  }
]
logic: "and"
updates: {
  "status": "verified",
  "verified_at": "2024-01-15T10:30:00Z"
}
```

**Output:**

```
updated_count: 1
success: true
```

### Example 2: Bulk Status Update

**Input:**

```
dataset: "01K8ZM9T72FNBZAGA629KZFXR5"
conditions: [
  {
    "column": "status",
    "operator": "equals",
    "value": "pending"
  },
  {
    "column": "created_date",
    "operator": "less_than",
    "value": "2024-01-01"
  }
]
logic: "and"
updates: {
  "status": "expired",
  "expiry_reason": "automatic_timeout"
}
```

**Output:**

```
updated_count: 156
success: true
```

### Example 3: Update Multiple Departments

**Input:**

```
dataset: "01K8ZM9T72FNBZAGA629KZFXR5"
conditions: [
  {
    "column": "department",
    "operator": "in",
    "value": "sales,marketing"
  }
]
logic: "and"
updates: {
  "division": "Revenue Operations",
  "budget_category": "customer_acquisition"
}
```

**Output:**

```
updated_count: 47
success: true
```

### Example 4: Update with OR Logic

**Input:**

```
dataset: "01K8ZM9T72FNBZAGA629KZFXR5"
conditions: [
  {
    "column": "priority",
    "operator": "equals",
    "value": "urgent"
  },
  {
    "column": "age_days",
    "operator": "greater_than",
    "value": "30"
  }
]
logic: "or"
updates: {
  "review_required": true,
  "escalation_level": "high"
}
```

**Output:**

```
updated_count: 89
success: true
```

### Example 5: Increment Counter

**Input:**

```
dataset: "01K8ZM9T72FNBZAGA629KZFXR5"
conditions: [
  {
    "column": "product_id",
    "operator": "equals",
    "value": "PROD-1234"
  }
]
logic: "and"
updates: {
  "view_count": 125,
  "last_viewed": "2024-01-15T14:22:00Z"
}
```

**Output:**

```
updated_count: 1
success: true
```

### Example 6: Update All Rows

**Input:**

```
dataset: "01K8ZM9T72FNBZAGA629KZFXR5"
conditions: []
updates: {
  "migration_status": "v2_completed",
  "migrated_at": "2024-01-15T00:00:00Z"
}
```

**Output:**

```
updated_count: 2450
success: true
```

## Common Use Cases

* **Status Updates**: Change record status based on conditions (e.g., pending → completed)
* **Bulk Operations**: Update multiple records matching criteria in a single operation
* **Data Enrichment**: Add or update fields with new information or calculated values
* **Workflow State Management**: Update processing states as workflows progress
* **Time-Based Updates**: Modify records that have aged beyond certain thresholds
* **Quality Control**: Flag or update records that meet quality criteria
* **User Management**: Update user attributes, permissions, or settings in bulk
* **Inventory Updates**: Modify product information, stock levels, or pricing
* **Data Normalization**: Standardize or clean up data values across multiple rows
* **Feature Flags**: Enable or disable features for specific user segments

## Error Handling

| Error Type               | Cause                                  | Solution                                                          |
| ------------------------ | -------------------------------------- | ----------------------------------------------------------------- |
| Dataset Not Found        | Dataset ID doesn't exist               | Verify the dataset ID is correct and the dataset exists           |
| Invalid Dataset ID       | Dataset ID format is incorrect         | Ensure dataset ID is a 26-character ULID                          |
| Dataset ID Required      | Dataset parameter is empty             | Provide a valid dataset ID                                        |
| Updates Required         | Updates parameter is missing or empty  | Provide at least one column-value pair in updates                 |
| Invalid Column           | Column in updates doesn't exist        | Verify column names match the dataset schema                      |
| Invalid Condition Column | Column in condition doesn't exist      | Check condition column names against dataset schema               |
| Invalid Operator         | Operator not in allowed list           | Use: equals, not\_equals, contains, greater\_than, less\_than, in |
| Invalid Data Type        | Update value type doesn't match column | Ensure values match the expected data types                       |
| Update Failed            | Server error during update             | Retry the operation or check server logs                          |
| Permission Denied        | Insufficient permissions               | Verify you have update permissions on the dataset                 |

## Notes

* **Conditional Updates**: Use conditions array to target specific rows. Empty conditions will update ALL rows in the dataset.
* **Validation**: The node validates that the dataset ID is a valid 26-character ULID format.
* **Updates Object**: The updates parameter is a JSON object where keys are column names and values are the new values to set.
* **Multiple Columns**: You can update multiple columns in a single operation by including multiple key-value pairs in the updates object.
* **Logic Operators**: Use "and" to narrow the selection (all conditions must match) or "or" to broaden it (any condition matches).
* **Atomic Operation**: The update is typically atomic - either all matching rows are updated or the operation fails.
* **Success Verification**: Always check the success field to confirm the operation completed without errors.
* **Update Count**: The updated\_count shows how many rows were modified. Zero count means no rows matched the conditions.
* **Data Types**: Ensure update values match the expected data types for each column (string, number, boolean, object, array).
* **Performance**: Updating large numbers of rows may take time. Consider breaking very large updates into batches.
* **Preview First**: Use the Query Data node to preview which rows will be affected before executing the update.
* **No Undo**: Updates are permanent. Consider backing up critical data before bulk updates.
* **Dynamic Dropdown**: The dataset field dynamically lists available datasets in your workspace.
