# Save Resultset

> Save a resultset for later use.

The Save Resultset node stores and modifies a resultset inside Datahub. A resultset is a local dataset stored in Datahub's internal SQLite database, reusable across multiple dataflows within the same collection: ideal for caching, synchronization, and intermediate storage. This node inserts, updates, deletes, or fully replaces the contents of a resultset based on the incoming data.

## What is a resultset?

A resultset is a structured dataset that is:

- Stored locally in Datahub, persisted in an internal SQLite database.
- Accessible across dataflows within the same collection.
- Often used in combination with the Resultset Changed trigger, the Resultset Saved trigger, and dashboards and forms.

## Configuration

| Setting | Required | Description |
| --- | --- | --- |
| Resultset | Yes | The resultset to use. When editing this property, you can create or modify the underlying SQLite table structure. |
| Action | Yes | How the incoming data is applied to the resultset: see Action types below. |
| Mapping | Yes | How columns from the incoming dataset are mapped to columns in the resultset. |

### Resultset configuration

When creating or editing a resultset, you can define the table structure and special column roles:

- **Key column**: acts as a unique identifier for records. Required for all actions except Replace. Used to determine whether records should be inserted, updated, or deleted.
- **Created column**: automatically filled with the current datetime when a record is inserted. Can only be assigned to columns of type Date or DateTime. Value is set only on insert.
- **Updated column**: automatically filled with the current datetime when a record is inserted or updated. Can only be assigned to columns of type Date or DateTime.

### Action types

| Action | Behavior |
| --- | --- |
| Replace | Replaces the entire contents of the resultset: all existing records are removed and incoming data is fully reinserted. No key column required. Created and Updated columns are filled on insert. |
| Insert | Inserts new records. Requires a key column. Records with an existing key are ignored; only new records are added. Created is filled on insert; Updated is not modified. |
| Update | Updates existing records. Requires a key column. Only records with a matching key are updated; records without a match are ignored. Updated is automatically filled; Created remains unchanged. |
| Insert or Update | Upsert behavior. Requires a key column. If the key exists the record is updated (Updated filled); if not, it's inserted (Created filled). |
| Delete | Deletes records matching the incoming keys. Requires a key column: only the key column needs to be mapped. |
| Except | Removes all records except those present in the incoming dataset: requires a key column and is the inverse of Delete. |

## Mapping

The Mapping property defines how incoming columns are written to the resultset. Not all resultset columns need to be mapped: unmapped columns remain unchanged (except when using Replace). For Delete and Except, usually only the key column is required.

## When to use it

The Save Resultset node is commonly used for:

- Caching external API data
- Sharing data between multiple dataflows
- Triggering flows based on resultset changes
- Persisting intermediate processing results

## Tips

- Use Replace for full refresh scenarios.
- Use Insert or Update for most synchronization use cases.
- Always define a key column when using any action other than Replace.
- Avoid using Save Resultset in the same dataflow as a Resultset Changed trigger, to prevent loops.
- Keep resultsets focused and small for optimal performance.