# Sorting Records

Organize your data by sorting records in ascending or descending order.

## Overview

Simpl allows you to sort your table view by any column, making it easy to find the most recent records, highest values, or alphabetically-ordered items.

## Sorting Basics

### Opening the Sort Panel

Click the **Sort** button in the toolbar to open the sort configuration panel.

### Selecting a Sort Column

Choose which column to sort by from the dropdown menu. All columns in your table are available.

### Choosing Sort Direction

Select the sort direction:

| Direction  | Icon | Description                      |
|------------|------|----------------------------------|
| Ascending  | ↑    | A-Z, 0-9, oldest first           |
| Descending | ↓    | Z-A, 9-0, newest first           |

## Sort Behavior by Type

Different column types sort in intuitive ways:

### Text Columns

- **Ascending**: A → Z (alphabetical)
- **Descending**: Z → A (reverse alphabetical)
- Case-insensitive sorting

### Number Columns

- **Ascending**: Smallest → Largest
- **Descending**: Largest → Smallest

### Date/Timestamp Columns

- **Ascending**: Oldest → Newest
- **Descending**: Newest → Oldest (most common)

### Boolean Columns

- **Ascending**: False → True
- **Descending**: True → False

### Null Values

Null values are sorted to the end regardless of sort direction. This keeps meaningful data at the top of your view.

## Common Sorting Scenarios

### Most Recent Records

For tables with timestamps (like `created_at` or `updated_at`):

1. Sort by the date column
2. Choose **Descending** order
3. Newest records appear first

### Alphabetical Lists

For name or title columns:

1. Sort by the text column
2. Choose **Ascending** order
3. Records appear A → Z

### Highest/Lowest Values

For numeric columns (prices, counts, scores):

1. Sort by the number column
2. Choose **Descending** for highest first, **Ascending** for lowest first

## Saved Sort Preferences

### Per-Table Settings

Your sort preference is saved for each table in your layout configuration. When you return to a table, your last sort order is preserved.

### Changing Default Sort

To set a new default sort for a table:

1. Apply your desired sort
2. The preference is automatically saved
3. This becomes the default for future visits

## Sorting with Filters and Search

Sort order is maintained when you:

- Apply filters - sorted results are filtered
- Use search - matching records keep sort order
- Change pages - all pages follow the same sort

This means you can:

1. Sort by "newest first"
2. Filter to "active" status
3. Search for "john"
4. Results: Active records matching "john", newest first

## Sort Indicators

### Active Sort Display

The current sort is indicated by:

- Sort column name displayed in the toolbar
- Arrow icon showing direction (↑ or ↓)

### Removing Sort

To remove sorting and return to default order:

1. Open the sort panel
2. Click **Clear Sort** or select "None"
3. Records return to their natural order (usually by primary key)

## Tips for Effective Sorting

### Use with Pagination

When browsing large tables:

- Sort first, then scroll
- Sorting applies across all pages
- Most relevant records appear first

### Combine with Filters

For specific subsets:

1. Filter to your target records
2. Sort to organize them
3. Scan efficiently for what you need

### Quick Analysis

Sorting helps with quick data analysis:

- Find outliers (sort by value, check top/bottom)
- Review recent activity (sort by date)
- Spot patterns (sort and scan)

## Current Limitations

### Single Column Sort

Simpl currently supports sorting by one column at a time. Multi-column sorting (e.g., sort by status, then by date) is not yet available.

### Sort Performance

For very large tables (millions of rows), sorting may add latency. Consider:

- Applying filters first to reduce dataset size
- Using indexed columns for faster sorts

## Next Steps

- [Customize your layout](/content/docs/features/layouts/index.html) to control which columns appear
- [Filter your data](/content/docs/features/filtering/index.html) before sorting
- [View record details](/content/docs/features/detail-view/index.html) for complete information
