This patch creates a new handler for cck fields, "Show first value only." When selected in a views field, the view will print just the first value in a multiple-value field. For example, if you're creating photo albums using a multiple-value imagefield, this allows you to show just the first picture from each album on a view listing all albums. It's a pretty simple change, but one I've needed more than once...

The patch is for content_views.inc.

Comments

amitaibu’s picture

Maybe you could have used this module to show as many nodes of a referenced filed as you would like.

nicholas_w’s picture

Referenced by is undoubtedly a cool module, however, I am not using a separate node for each photo. Instead, a single node uses a mutiple-value imagefield to hold all the pics.

David Lesieur’s picture

Title: Show first in multiple value fields » Show first or last of multiple value fields
Version: 5.x-1.6-1 » 5.x-1.x-dev
StatusFileSize
new4.04 KB

I think this is a very useful feature. This new patch improves on the previous one:

  • Reduced code duplication.
  • Made sure the query does not return more rows than needed.
  • Added a "Show last value only" handler.
yched’s picture

Looks cool. I'm currently reviewing this.

asak’s picture

A no-patch solution using views only: Node: Distinct filtering .

stella’s picture

This patch worked perfectly for me.

Cheers,
Stella

yched’s picture

Status: Needs review » Fixed

Er, I forgot to close this issue, but the patch made it in 5.x-1.x (and 6.x-1.x) a few months ago. Thanks David !

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

rimma’s picture

Anyone can give some suggestions how to solve this issue in Drupal 6.4 using View 6.2 dev.

Thanks in advance.

yched’s picture

This feature is already in both D5 and D6 branches (although buggy in D6 rc6, grab latest 6.x-2.x-dev)

csform’s picture

I need to use the path but I dont know how or where to used?, Could someone help using the path please!

Thanks

Delta Bridges’s picture

Status: Closed (fixed) » Active

I am confused as well... I am using 6.3.1 but where is the UI for this option?
Many thanks,

Daniel A. Beilinson’s picture

Version: 5.x-1.x-dev » 6.x-3.x-dev
Category: feature » support

subscribe :-)

markus_petrux’s picture

Version: 6.x-3.x-dev » 6.x-2.x-dev
Category: support » feature
Status: Active » Fixed

I don't know in D5, but support for D5 is almost on a dead end. No human resources available. If it needs a patch, then that's welcome, but I assume it is done, as suggested by yched comment in #10.

For CCK2 in D6, this is already possible as well, but it uses a different implementation than the one propossed in the patches above, that are probably D5 related, meaning the code cannot be compared because Views integration changed slightly since then.

So for CCK2 in D6, for multiple value fields in views you should use an option labelled "Group multiple values". Once this option is enable, you can choose how many values to show, starting from, and whether these values should be displayed in reversed order.

Daniel A. Beilinson’s picture

But if I choose to show me only one value and set starting from or ending - it's not show me last value, because I create new nodes and total amount of values'll be greater and greater, so if i choose one value start from 16, when total amount of fields'll be 17 - it'll be 16 or 17, not exactly 17.

markus_petrux’s picture

This issue is so old (started in November 2007, closed in April 2008), that I think it would be better if you could open a separate issue with as much information as possible to reproduce the problem. Thanks

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.