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.

Project information

Releases