> For clean Markdown content of this page, append .md to this URL. For the complete documentation index, see https://learning.postman.com/llms.txt.

# Use a dataset with a collection run

Datasets are available on Postman Solo, Team, and Enterprise plans. For more information, see the [pricing page](https://www.postman.com/pricing/).

When you [run a collection](/docs/tests-and-scripts/running-collections/intro-to-collection-runs/), you can use a [dataset](/docs/tests-and-scripts/datasets/overview/) as iteration data. Each row returned by the selected view becomes one iteration, so the same requests run with different inputs. Unlike a [data file](/docs/tests-and-scripts/running-collections/test-data/working-with-data-files/), a dataset is reusable and queryable, and it isn't subject to file size limits.

You can also use a dataset with a [performance test](/docs/tests-and-scripts/performance-testing/test-data/performance-test-dataset/) or a [monitor](/docs/monitoring-your-api/test-data/monitors-datasets/).

## Run a collection with a dataset

Select a dataset and view to use as iteration data. The view controls which rows and columns are available during the run.

To run a collection with a dataset, do the following:

1. Click ![Items icon](https://assets.postman.com/postman-docs/aether-icons/v12/icon-descriptive-items-stroke.svg#icon) **Items** in the sidebar, then click **Collections** and select the collection you want to run.

2. Reference the dataset fields in your requests. See [Use iteration data in requests](#use-iteration-data-in-requests) and [Use iteration data in scripts](#use-iteration-data-in-scripts).

3. Select the collection again and click ![Run icon](https://assets.postman.com/postman-docs/aether-icons/v12/icon-action-run-stroke.svg#icon) **Run** in the upper right.

4. Select **Functional**, then select **Local**.

5. Click the **Iteration data** dropdown list and select the **Datasets** tab.

6. Select the dataset you want to use, then select a view with the data you want to run against.

   You can click ![Add icon](https://assets.postman.com/postman-docs/aether-icons/v12/icon-action-add-stroke.svg#icon) **Create a new dataset** or **Create a new view** to create and select a dataset or view without leaving the collection run configuration.

7. (Optional) Click the **Data** tab in the left pane to preview the view you selected.

8. (Optional) [Control how many iterations run](#control-how-many-iterations-run).

9. Click **Start run**.

The collection run summary shows the data used for each iteration.

## Control how many iterations run

By default, Postman sets the number of iterations to the number of rows returned by the selected view, running one iteration for each row. You can change how many iterations run and how Postman assigns data when there are more iterations than rows:

* **Iterations** — Enter the number of times to run the collection. If you enter fewer iterations than the number of rows in the view, Postman uses the first rows in the view, one for each iteration.
* **Iteration strategy** — Select how the extra iterations get their data when the view's rows run out:

  * **Round robin** — Continue from the first row for the remaining iterations.
  * **Repeat last** — Continue using the last row for the remaining iterations.
  * **Stop at end** — Stop the run when the rows run out.

Both functional collection runs and [performance tests](/docs/tests-and-scripts/performance-testing/test-data/performance-test-dataset/#iteration-strategies) support iteration strategies, but they work differently. In a functional run, the strategy controls how extra iterations get their data when the view's rows run out. In a performance test, the strategy controls how rows are distributed across virtual users.

## Use iteration data in requests

Dataset fields are automatically exposed as variables during the run. You can reference them using the `{{variable}}` syntax. For example, if your dataset has a `userId` field, reference it in your request URL as `{{userId}}`. Learn more about [using variables](/docs/use/send-requests/variables/variables).

```http showLineNumbers={false}
GET /user?userId={{userId}}&email={{email}}&name={{name}}
```

## Use iteration data in scripts

You can access the values from the current iteration in pre-request and post-response scripts using `pm.iterationData`. Learn more about [using iteration data variables in scripts](/docs/tests-and-scripts/write-scripts/postman-sandbox-reference/pm-variables#pmiterationdata).

```js showLineNumbers={false}
console.log(pm.iterationData.get("email"));
```

For more advanced usage, such as querying the dataset beyond the current iteration or referencing datasets, sources, and views by ID, see [Use datasets](/docs/tests-and-scripts/datasets/use-datasets/).