> For the complete documentation index, see [llms.txt](https://docs.appfarm.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.appfarm.io/library/action-nodes/sort-objects.md).

# Sort objects

The Sort objects action node updates the order of objects in a [data source](/reference/apps/data/data-sources.md), either randomly or according to one or more sorting rules.

## Usage

This action node is used to control sorting of a data source at runtime. Unlike sorting applied directly on a data source which is constantly evaluated, sorting with this action node is only applied when the action node is run.

This behavior is useful when you want to enable client users to sort data from the UI. You can configure default sorting triggered by the [On app load event](/reference/apps/app-settings.md#event-handlers), and implement sorting operations in the app's UI and actions.&#x20;

{% hint style="info" %}
**Good to know**

Sorting applied directly on a data source can not be used on conjunction with the Sort objects action node.
{% endhint %}

## Properties

<table><thead><tr><th width="218">Property</th><th>Description</th></tr></thead><tbody><tr><td><strong>Data Source</strong></td><td>The data source on which to apply the sort.</td></tr><tr><td><strong>Random Sort</strong></td><td>Apply a random sorting algorithm (the <a href="https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle">Fisher-Yates shuffle</a>). Cannot be used in conjunction with rules specified under <strong>Sorting</strong>.</td></tr><tr><td><strong>Sorting</strong></td><td>Add <a href="#sorting">sorting rules</a>.</td></tr></tbody></table>

### Sorting

Apply one or more sorting rules to the data source. If multiple rules are added, they will be applied from the top down.

<table><thead><tr><th width="221">Property</th><th>Description</th></tr></thead><tbody><tr><td><strong>Sort Field</strong></td><td>An <a href="https://app.gitbook.com/o/-MiLT3Dgct6rIVIV1q4t/s/-MiLU-xcHu0eLZiTxcmZ/~/changes/prRTqdvFdLPTGQu5aApk/reference/global-data-model/object-classes#object-class-properties">object class property</a> to sort on.</td></tr><tr><td><strong>Sort Order</strong></td><td>Whether the sort should be ascending or descending. Ascending will sort numbers from smallest to largest and strings from A–Z. Descending will sort in the opposite direction.</td></tr></tbody></table>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.appfarm.io/library/action-nodes/sort-objects.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
