Would be nice to be able to show a count for a multiple value field when displayed in a View. Makes sense when there are lots of values. I might even love a feature whereby a regular 'group multiple values' field switches to a count when there are too many to show (i.e. greater than 10). not sure if that can be an option on the handler.

Comments

KarenS’s picture

This wouldn't have (as) been easily possible in Views 1, but is very doable in Views 2.

iqbalbaskara’s picture

hello all, i'm interested in doing this too in Views 2. could anybody please share how?
thanks in advance

pendashteh’s picture

this would be great. the nodereferer.module already do the exact with back references.
for example you could have a column in your table that shows how many nodes of type B have refered to this node.
and i think it should be discussed on views issues not cck.

giorgio79’s picture

Project: Content Construction Kit (CCK) » Drupal core
Version: 6.x-1.x-dev » 8.x-dev
Component: General » field system

I have just been looking for this. I believe the Field API would need to expose the item count of multi value fields to Views in order to do this.

Found several posts looking to do this in general
http://drupal.org/node/879652
http://stackoverflow.com/questions/3390947/finding-length-of-multi-value...

Also requested here deletion, sorting and paging for multi value fields:
#1267476: Multi Value Fields - paging, sorting, deletion

yched’s picture

Project: Drupal core » Views (for Drupal 7)
Version: 8.x-dev » 7.x-3.x-dev
Component: field system » fieldapi data

Views handlers for fields are provided by the Views module in D7/D8.

dawehner’s picture

In general it would help here a lot of the new handler could be inherited from the views_handler_field_field.inc but at the moment you will always render multiple values because render_item is defined. Perhaps $items could be changed right so this doesn't matter.

You can't undefine a method of a class in a subclass in php.

sokrplare’s picture

You can kind of accomplish this (at least in the way I needed it) using Aggregation and Count DISTINCT. This lays it out actually - http://drupal.stackexchange.com/a/44185/6581

kenton.r’s picture

Version: 7.x-3.x-dev » 8.x-3.x-dev
Issue summary: View changes

It would be nice to have a count of multiple values available. There are times when I would use aggregation to sum the counts of values.

DamienMcKenna’s picture

Project: Views (for Drupal 7) » Drupal core
Version: 8.x-3.x-dev » 8.9.x-dev
Component: fieldapi data » views.module

In Drupal 8 the Views module was moved into core, so I'm moving this issue into the core issue queue.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Lendude’s picture

Going through old issues.

Not sure if adding a field handler for this would be the way to go here, expanding the 'Multiple field settings' in \Drupal\views\Plugin\views\field\EntityField::multiple_options_form with a 'count' option might work, or people could do this in a theme since you can just run this through '#theme' => 'item_list'

But offering this option might help people avoid switching on aggregation which always brings a whole new set of problems

candelas’s picture

It would be great to have this :)

Liam Morland’s picture

This would be great. In addition to count, it could sum, average, etc.

In the meantime, field_count_formatter module is useful.