Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

Views field comparison

Security covered Maintenance fixes only 62 sites

Part of the Views ecosystem · 284 projects

This module allows you to compare fields within a Drupal Views query. You can filter or sort content based on direct comparisons between two fields or compare a field against a static value. This provides more flexibility for building advanced content displays.

Overview

The Field Comparison for Views module allows you to perform comparisons between fields within a Views query in Drupal 8 and beyond. This feature, originally part of the popular Views module in Drupal 7, enables you to filter or sort content based on field-to-field comparisons or field-to-static-value comparisons.

With this module, you can build advanced queries that compare values from different content fields, such as dates, numbers, text fields, and more. This gives you enhanced flexibility in controlling the display of your content and ensures that Views can meet more specific use cases for your Drupal site.

Key Features

Field-to-Field Comparisons: Compare fields directly within Views, such as checking if one date field is earlier or later than another.
Field-to-Static Value Comparisons: Compare a field against a fixed value (e.g., check if the price field is greater than $50).
Easy Integration: Seamlessly integrates into the Views interface, allowing for intuitive configuration directly from the Views UI.
Flexible Filtering and Sorting: Add field comparison conditions to your Views filters or sort criteria, enabling powerful content displays.
Drupal 8+ Compatibility: Fully ported and maintained for Drupal 8 and later versions.

Usage

Creating a View with Field Comparison:
When editing a view, add a new filter or sort criterion.
Select the field you want to compare.
Choose the comparison operator, such as =, >, <, !=, etc.
Optionally, select another field to compare it to or input a static value.
Examples:
Date Comparison: Display content where start_date is greater than the end_date.
Number Comparison: Show all products where the price field is less than 100.
For more detailed examples, check the module documentation or issue queue.

Develop Views field comparison using DDEV ⚙

If you haven't already, install DDEV.

git clone [email protected]:project/views_field_comparison.git
cd views_field_comparison
ddev config --project-type=drupal --docroot=web --php-version=8.4 --corepack-enable --project-name=views-field-comparison
ddev add-on get ddev/ddev-drupal-contrib
ddev add-on get s-ayers/ddev-drupal-contrib-mkdocs
ddev start
ddev poser
ddev symlink-project
ddev drush site:install -y
ddev drush pm:install views_field_comparison -y
ddev drush config:export -y
ddev drush user:login

Consider sponsoring DDEV development.

Drupal 10–11

Ask your assistant about Views field comparison

Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
3
Tracked since
Oct 2024
Latest release
2 months ago
Releases (12 mo)
1 ▲ from 0
Maintenance
Active

Release Timeline

Releases

Version Type Core PHP Release date
1.0.1 Stable 10–11 Aug 5, 2026
1.0.0 Stable 10–11 Oct 18, 2024
1.0.x-dev Dev 10–11 Oct 18, 2024