Views Conditional is a simple module that allows you to define conditionals (if xxx then yyy)
with fields in views.

Drupal 9/10 Conditions include:

  • Equal To
  • Not Equal To
  • Greater Than
  • Greater Than or Equals
  • Less Than
  • Less Than or Equals
  • Empty
  • Not Empty
  • Contains
  • Does Not Contain
  • Length Equal To
  • Length Not Equal To
  • Length Greater Than
  • Length Less Than

Views conditional allows you to output text based on the result of the condition.

---

How to use Views Conditional in your Views:
1. Create a view. Add some fields under "FIELDS".
2. Click on "ADD" next to fields. Scroll down to "Views: Views Conditional", probably found near the bottom of the list.
3. Add and configure fields...
4. Choose a field to run a condition against, and provide values accordingly.
5. Save, views conditional handles the logic and returns as specified.

Documentation

Read the WebWash Tutorial for Views Conditional

Note:
In many cases since Drupal 8, this module may be obsolete, because using Twig for Views rewriting we can now use conditional logic.

{% if {{ field_show_other_flag }} %}
  {{ field_other_thing }}
{% else %}
  {{ field_main_thing }}
{% endif %}
Supporting organizations: 

Project information

Releases