0

I have a 'Video' content type with a 'video_translations' field collection which is allowed unlimited values. This field collection has a 'language' and 'url' field attached and I want to be able to filter by the 'language' field.

I've created a relationship in the View for the 'video_translations' field and set the 'Delta' value to 'All'. Then I created a filter for the filed collection item 'language'.

Filtering works okay like this, but using the Delta value of 'All' creates duplicates in my view when viewing all items. If I set that Delta value to, for example, '1', then filtering only looks at the first field collection item, and ignores other values.

e.g. if I have 2 'video_translations' on a single Video, the first has the 'language' field set to French, and the second to Russian, then with the Delta value set to 'All', that single Video is displayed twice. Once for each 'video_translations' value. But with the relationship's Delta value set to '1', the Video only appears once, but I'm never able to filter by the second 'language' field.

I want to display the Video once, regardless of how many values the 'video_translations' field has, and also be able to filter by any of the field collection's 'language' field.

How can I do this in Drupal 7?

1

The "distinct" button exists in Drupal 7 as it did in Drupal 6 but is buried. Go into "Query Settings" under "Advanced -> Other" and check the box for "distinct." That'll display duplicate values only once regardless of how many deltas exist.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.