> For the complete documentation index, see [llms.txt](https://cgps.gitbook.io/data-flo/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cgps.gitbook.io/data-flo/reference-guide/select-rows.md).

# select-rows

## Description

<mark style="color:purple;">`select-rows`</mark> *adaptor selects row(s) from a datatable and generates a new datatable based on this selection*.

## Inputs

**`data`**\
Type: `datatable`\
Required: Yes\
The datatable containing the rows to be selected.

**`begin`**\
Type: `number`\
Required: No\
The position of the first row to be selected. A negative number can be used to count from the end of the datatable (e.g. `-5` would start at the fifth-to-last row). If unspecified, defaults to `1` (first row of data).

**`end`**\
Type: `number`\
Required: No\
The position of the last row to be selected. A negative number can be used to count from the end of the datatable. If unspecified, defaults to `-1` (last row of data).

**`limit`**\
Type: `number`\
Required: No\
A positive number specifying a limit on the number of rows to be selected. If unspecified, no limit will be applied.

## Outputs

**`data`**\
Type: `datatable`\
A datatable containing the selected rows.

## Examples

### Example 1: Default behaviour.

#### Inputs:

`data`:

| id | code  | name           |
| -- | ----- | -------------- |
| 1  | en-GB | United Kingdom |
| 2  | tr-TR | Turkey         |
| 3  | en-US | United States  |
| 4  | hi-IN | India          |

`begin:` 1

`end:` 3

`limit:` *null (empty)*

#### Outputs:

`data`:

| id | code  | name           |
| -- | ----- | -------------- |
| 1  | en-GB | United Kingdom |
| 2  | tr-TR | Turkey         |
| 3  | en-US | United States  |

-> Selected rows from `1` to `3`.

### Example 2: Select rows with specific limit.

#### Inputs:

`data`:

| id | code  | name           |
| -- | ----- | -------------- |
| 1  | en-GB | United Kingdom |
| 2  | tr-TR | Turkey         |
| 3  | en-US | United States  |
| 4  | hi-IN | India          |

`begin:` *null (empty)*

`end:` *null (empty)*

`limit:` 2

#### Outputs:

`data`:

| id | code  | name           |
| -- | ----- | -------------- |
| 1  | en-GB | United Kingdom |
| 2  | tr-TR | Turkey         |

-> Selected rows from `1` to `2` as the limit was set to `2` rows.
