# 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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://cgps.gitbook.io/data-flo/reference-guide/select-rows.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
