Duplicate display issues when using Views to display multigroups and a field NOT from the multigroup

s4j4n - August 21, 2009 - 21:58
Project:Content Construction Kit (CCK)
Version:6.x-3.x-dev
Component:content_multigroup.module
Category:support request
Priority:normal
Assigned:Unassigned
Status:closed
Issue tags:cck multigroup views duplicate
Description

I am experiencing problems with correctly rendering views of a content type I've created that uses multigroups. Fields NOT part of a multigroup are duplicated in the output and grouped with the multigroup fields.

I looked at a lot of the other CCK issue posts. People mention duplication of multigroup data, but as far as I've seen no one has mentioned duplication of non-multigroup fields when rendering both multigroup fields and non-multigroup fields in a single view.

I am using multigroups for managing events. I have set up a content type that looks something like this...

  • event_title
  • mulitgroup_day
    • date
    • description
  • additional_info

Just to be clear, that type contains:

  • 2 normal fields: "event_title" and "additional_info"
  • 1 multigroup "multigroup_day" containing 2 fields: "date" and "description"

I created an "event" (i.e. some content of this content type) with 2 dates.

In views I've been able to successfully render the multigroup data in a table or a list, with no duplication or strange grouping behavior. But now I want to render a view like this:

event_title

  • date1
    description1
  • date2
    description2

additional_info

But I only seem to be able to render the following view:

  • event_title
    date1
    description1
    additional_info
  • event_title
    date2
    description2
    additional_info

Note that I have set up two filters:

  1. "Content multigroup: Multigroup_Day in Event + delta" - which filters on the date
  2. "Content Date - delta not empty"

Not sure if this is a multigroup bug or perhaps my inexperience with using Views, but perhaps someone can shed some light on this problem.

(many thanks to the developers for this module!!)

#1

markus_petrux - August 21, 2009 - 22:19
Category:bug report» support request
Status:active» fixed

If you use more than one field from a multigroup in a view, add a filter to that view from the "Content multigroup" group, the one that matches the multigroup you're interested in. This filter adds a join that should synchronize the fields in the multigroups by delta. For reference, please see #416154: Synchronized deltas Views integration: Filter on equal deltas in multigroups

In addition to the above, you can add a filter for Delta column related to any field in the multigroup, and set it up to filter where delta = 0. This will show only the first subgroup of items in the multigroup.

Aside... when you add fields from a multigroup that is configured to allow multiple values, then you have a 1 to N relation, and that means duplicates for fields in the 1 side of the relation.

If you want to display the whole multigroup as if it was a single field, then search for Custom Views Field module, and here you can use PHP to use fieldgroup_view_group() to render the whole multigroup. Look at content_multigroup.inc in panels subdirectory of multigroup module to see an example.

#2

System Message - September 4, 2009 - 22:20
Status:fixed» closed

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

#3

hellomobe - October 17, 2009 - 00:20
Status:closed» active

Sorry for my inexperience, please explain in more detail how to show all subgroups of a multigroup field under one title to avoid duplicates. I have the filter for the content_multigroup. I'm not understanding how to change the delta or add the custom php field if necessary. I'm ultimately trying to get to a xml output with children elements.

#4

markus_petrux - October 31, 2009 - 21:10
Status:active» fixed

Fields in multigroups are fields that accept multiple values. These are stored in separate tables where a delta is added to the primary key. So the relation between the node or other single value fields and fields in multigroups is 1 to N. This means a query (a view) that mixes single value fields or node fields with fields in multigroups will generate duplicate rows.

To avoid this, you can build the view to just print the first item in a multigroup. That can be done adding a filter for the delta key that corresponds to a field in the multigroup, and say delta = 0, which is the first item.

Another method that can be used with multiple value fields, is that you can tell these fields to group multiple values in the same views cell. This is an option in multiple value fields (views field settings).

#5

paganwinter - November 6, 2009 - 11:46

Subscribing...

#6

System Message - November 20, 2009 - 11:50
Status:fixed» closed

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

#7

Dracolyte - December 5, 2009 - 19:37
Status:closed» active

I'm still having trouble with multigroups displaying duplicate values. I'm on Drupal 6.14. I have a multigroup with three elements: two text fields and a node reference. I've tried following your directions above, but I'm having trouble understanding your comments about a views filter. E.g., "add a filter to that view from the "Content multigroup" group" -- In the views admin screen, when I click to add a filter, I don't have any "Content multigroup" listed in the groups dropdown, nor is there any reference to the multigroup in the content list. (All three of my elements are there, listed separately.)
Could you tell me how to add the filter you describe?
Thanks very much.

#8

markus_petrux - December 5, 2009 - 20:32

@Dracolyte: I do not exactly recall when this feature was added to CCK3 (it's been a while already), you may want to check you have the latest version (compare the timestamps in the content.info, for example). Also, make sure there's a views subdirectory inside the content_multigroup directory.

If you have the latest version, then in Views UI, when you click "Add filter", you should see an option "Content multigroup" in the group selector of the add filter form, and there you should find an entry for each multigroup defined in your system. If you don't, it could be something odd in your particular installation. Try clearing the Views cache to see if that helps.

#9

Dracolyte - December 5, 2009 - 20:36

Thanks very much, Markus. I've been reading through the other threads --esp. http://drupal.org/node/416154 -- and am about to try CCK3. Sorry to bother you, and your quick reply is a class act and very much appreciated.

#10

markus_petrux - December 5, 2009 - 20:43
Status:active» closed

Re: "and am about to try CCK3"

Ahah! ...so, this issue back to closed. Yes, you need latest version of CCK3.

 
 

Drupal is a registered trademark of Dries Buytaert.