Hi

I have created a multigroup field called "Contact person" that has three text fields:
- Salutation
- Fistname
- Lastname

Now I would like to display this multigroup field in a view with a label:

Contact persons:
Mister Super Duper
Miss Bay Be

If I add the three CCK field to my view and Select the option "Group multiple values" the output looks like this:
Salutation:
Mister
Miss
Firstname:
Super
Bay
Lastname:
Duper
Be

Is the a possibility of displaying the multigroup field this way? Did I miss an option?

Comments

As a workaround I tried to use the rewrite function of view to make a compund field of [salutation][firstname][[lastname] but this did not work either.

Am I the only one testing the nested field group?

A patch is available here #300084: Nested fieldgroup:

http://drupal.org/node/300084#comment-2825930

I'm looking to do the same thing.

As cool as multigroup is it wont be any use to me unless I can spit it out nicer in views.

@ayalon

Did you have any luck?

I've spent a few hours trying to do the same thing with no luck. Does anyone have any guidance on how to do what ayalon asked above?

Note that you can also manipulate fields in views by using php via this module:
http://drupal.org/project/views_customfield

I'd be interested to know if this kind of views integration (described by ayalon) is possible out of the box or if additional modules/php/etc are required. If it's simply a matter of using what's already there in views and multigroup cck, then I think that would be the best solution.

StatusFileSize
new17.88 KB
new13.3 KB
new11.03 KB
new67.18 KB

I managed to get content multigroup working for my needs using the views customfield module. I've pasted the code I used below, although this is a really simple use case.

Basically, I was having trouble with a multigroup housing two fields:
Field 1: Textfield for Quantity
Field 2: Node Reference for product references

As the product kit can have multiple products, I needed to record how many of each product was in the kit, but when creating the view, the display either showed the value of one quantity field for all records, or had a list of all quantites in each record.

To get around it, I had to:

  1. Add the content field (quantity) to the view but exclude the display (this gives $data in customfield the info it needs)
  2. Make sure the Group Multiple Values checkbox was checked. This puts the content field into an array with delta value as the key
  3. Add a customfield of PHP type and drop in the below code

<?php
$delta
= db_result(db_query("SELECT delta FROM {content_field_reference_product} c WHERE vid = %d AND field_reference_product_nid = %d", $data->node_vid, $data->node_node_data_field_reference_product_nid));
print
$data->node_data_field_quantity_field_quantity_value[$delta]['value'];
?>

The code above uses the db_result and db_query function to retrieve the delta value. I am not reallu sure how the performance hit taken by embedding a db query into a customfield, if anyone knows, I am really interested to know.

The attached images just show the states when trying to get the view working.

Hope that helps someone, or if anyone knows when kind of performance hit I'm taking by embedding a query into a custom field.

takamin, your answer is a big help, but could you expound on what the various items in the db_query should correspond to? Like content_field_reference_product?

Meanwhile 8 month ago....
are there any (better) solution today?

Thanks a lot.

David

Absolutely. Multigroup module exposes a filter. When configuring your view, simply activate the multigroup filter for the multigroup in your content type, and it will automagically link the fields based on their delta! :-)