Skip to main content
added 596 characters in body
Source Link
dmsmidt
  • 517
  • 3
  • 11

I fear you will need a subquery for that. You can do that in a custom module.

/**
 * Implements hook_views_query_alter().
 */
function MODULE_NAME_views_query_alter(&$view, &$query) {
  $max = db_query('select max(YOUR_TABLE_COLUMN) from YOUR_TABLE')->fetchField();
  $query->add_where(0, db_and()->condition('TABLE.YOUR_FIELD_NAME', $max));
}

The tricky part here is to create your select query and find the correct field name/alias. Have a look at the query output of your view to find the correct parts.

Original answer (before clarification)

Instead of a contextual filter you can use a sort on the 'Volume' field. Sort descending. That way the articles with the highest 'volume' are at the top.

If you want to show only articles with a number higher than X you could add a regular filter for that.

Instead of a contextual filter you can use a sort on the 'Volume' field. Sort descending. That way the articles with the highest 'volume' are at the top.

If you want to show only articles with a number higher than X you could add a regular filter for that.

I fear you will need a subquery for that. You can do that in a custom module.

/**
 * Implements hook_views_query_alter().
 */
function MODULE_NAME_views_query_alter(&$view, &$query) {
  $max = db_query('select max(YOUR_TABLE_COLUMN) from YOUR_TABLE')->fetchField();
  $query->add_where(0, db_and()->condition('TABLE.YOUR_FIELD_NAME', $max));
}

The tricky part here is to create your select query and find the correct field name/alias. Have a look at the query output of your view to find the correct parts.

Original answer (before clarification)

Instead of a contextual filter you can use a sort on the 'Volume' field. Sort descending. That way the articles with the highest 'volume' are at the top.

If you want to show only articles with a number higher than X you could add a regular filter for that.

Source Link
dmsmidt
  • 517
  • 3
  • 11

Instead of a contextual filter you can use a sort on the 'Volume' field. Sort descending. That way the articles with the highest 'volume' are at the top.

If you want to show only articles with a number higher than X you could add a regular filter for that.