Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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?
Comment | File | Size | Author |
---|---|---|---|
#6 | grouping_setting.jpeg | 67.18 KB | takamin |
#6 | with_customfield.jpeg | 11.03 KB | takamin |
#6 | with_grouping.jpeg | 13.3 KB | takamin |
#6 | without_grouping.jpeg | 17.88 KB | takamin |
Comments
Comment #1
ayalon CreditAttribution: ayalon commentedAs 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
Comment #2
Feet CreditAttribution: Feet commentedI'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?
Comment #3
zdean CreditAttribution: zdean commentedI'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?
Comment #4
zeezhao CreditAttribution: zeezhao commentedNote that you can also manipulate fields in views by using php via this module:
http://drupal.org/project/views_customfield
Comment #5
zdean CreditAttribution: zdean commentedI'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.
Comment #6
takamin CreditAttribution: takamin commentedI 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:
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.
Comment #7
Melissamcewen CreditAttribution: Melissamcewen commentedtakamin, 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?
Comment #8
DavidBoo CreditAttribution: DavidBoo commentedMeanwhile 8 month ago....
are there any (better) solution today?
Thanks a lot.
David
Comment #9
ambelovsky CreditAttribution: ambelovsky commentedAbsolutely. 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! :-)