# sort-list

## Description

<mark style="color:purple;">`sort-list`</mark> *adaptor sorts values in a list.*

Sorts a list by ascending or descending order. In ascending mode, numbers come first and then text (1,2,cow), in descending mode text comes first (cow,2,1). Use before or after [<mark style="color:purple;">`remove-duplicate-list-values`</mark>](/data-flo/reference-guide/remove-duplicate-list-values.md) adaptor to get a sorted list without duplicates.

## Inputs

**`list`**\
Type: `list`\
Required: Yes\
The list to be sorted.

**`sort direction`**\
Type: `text`\
Required: No\
Specifies the sort direction, should be either `asc` (for ascending order) or `desc` (for descending order).

## Outputs

**`list`**\
Type: `list`\
A list containing the sorted values.

## Examples

### Example 1: Default behaviour.

#### Inputs:

`list`:

1. January
2. February
3. March
4. April

`sort direction:` *null (empty)*

#### Outputs:

`list`:

1. April
2. February
3. January
4. March

-> Sorted a list in ascending order.

### Example 2: Sort list in descending order.

#### Inputs:

`list`:

1. January
2. February
3. March
4. April

`sort direction:` desc

#### Outputs:

`list`:

1. March
2. April
3. February
4. January

-> Sorted a list in ascending order.

## Use case

* Create an alphabetic reference of names.
* Separate out text and numbers.


---

# 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/sort-list.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.
