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

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