Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: Views Bulk Operations (VBO) 4.4.8 Minor update available for module views_bulk_operations (4.4.8). Release: Commerce Authorize.Net 2.0.0 Major update available for module commerce_authnet (2.0.0). Usage Milestone: Easy Breadcrumb Module easy_breadcrumb crossed 100,000 active installs. Release: SDC Components 2.0.3 Minor update available for module sdc_components (2.0.3). Release: Commerce ML Starter 8.x-1.94 Minor update available for module cmlstarter (8.x-1.94). Release: Field Label Visibility (an intuitive approach to editing node forms) 1.0.3 Minor update available for module field_label_visibility (1.0.3). Release: DruxtJS 1.3.1 Minor update available for module druxt (1.3.1). Release: Monobank payment API 1.0.4 Minor update available for module monobank (1.0.4). Release: Personified 1.0.4 Minor update available for module personified (1.0.4). Module Revived: Fleetview client 1.1.2 Module fleetview_client updated after 16 months of inactivity (1.1.2).

Views Sort Expression

306 sites Security covered Drupal 9–11

Part of the Views ecosystem · 208 projects

View on drupal.org

This module allows for advanced sorting of view results using custom SQL expressions. It enables sorting options not available in default handlers, such as displaying NULL values last or prioritizing certain content types.

This is an advanced module as it basically requires you to know the SQL of the view and how to construct expression-based ORDER BYs.

It aims to be a helper module which provides custom ordering that is normally not possible with default sort handlers.

By sorting by expressions you can do things like, showing NULL items last when sorting by a numeric field, or creating a custom sort order putting some content types on top. The possibilities are endless.

You may use whatever is currently available in the query. For that reason, you should always enable the "Show the SQL query" on the Views setting page to help you find the proper field aliases. Adding a field or the like to the view doesn't necessarily alter the SQL Query. You may find it useful to add what you need in the proper sort order, use it inside the expression, then rearrange your expression where you need it.

Depends on

Dependencies of the latest stable release

  • views Drupal core

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
1
Tracked since
Sep 2026
Latest release
13 hours ago
Releases (12 mo)
1 ▲ from 0
Maintenance
Active

Releases

Version Type Core Release date
2.0.2 Stable 9–11 Sep 8, 2026