When you add a cck field with multiple values in a view you can choose the "Group multiple values" option which works very good. But when you add an Relationship to get a cck Field from referenced nodes you have only a settings for delta so you could choose which delta or all. Below this option there is the following help text: "If you select "All", each item in the field will create a new row, which may appear to cause duplicates."
And at this place it would be wonderfull to have your great "Group multiple values" option.
Because i want to have all values but not in different rows.
So instead a result like:
node5_cck_field_a | node55_cck_field_c
node5_cck_field_a | node56_cck_field_c
node5_cck_field_a | node57_cck_field_c
I would like to have:
node5_cck_field_a | node55_cck_field_c, node56_cck_field_c, node57_cck_field_c
If you know a way or a module to get this result already, i would be pleased about a hint.
Comments
Comment #1
apatrinos commentedI too have the exact same problem.
Comment #2
markus_petrux commentedUse the "Group multiple values" option and then override the theme function that's used in that case.
- #556232: multiple values in views
Comment #3
Vasudeva commentedI don't think it's a duplicate of #556232: multiple values in views because in this issue there is one field with multiple values.
But in my case i got the multiple values of different nodes whereat each field contains only a single value.
Nevertheless i changed my code like described in #556232: multiple values in views.
As i expected it didn't change the output.
It change the output, if you have a field with multiple values and use the "Group multiple values" option.
But my problem is that there is no option like this for multiple values consisting of a singular field from different nodes.
Thanks for your help. Maybe you have another idea.
Comment #4
markus_petrux commentedOh, sorry then.
More ideas:
- Use Views Custom Field module instead of the relationships, and here you can use PHP code to read the records and render them in just one cell.
In any case, we're subject here to the capabilities of what's possible in SQL. A join between 2 tables with a 1:n relation will generate duplicates. If you do not want duplicates, do not join those tables, then read records from second table per record of first table. This is possible with Views Custom Field.
Comment #5
Vasudeva commentedMarkus: Thank you very much for your idea.
So for other people with this problem here is my way:
1) Install and enable http://drupal.org/project/views_customfield
2) I find it helpful to read #467190: Basic usage information
3) In the view add the field with the node references and select the options "Exclude from display" and "Group multiple values"
4)Add a Customfield "PHP Code".
5)In the "value" field of the Customfield "PHP Code" you can paste the following code and customize it to your needs. It's only an example with field and table names which will not exist on your system. So it will not work without changing them.
That's it. Hope it works for all who test it.
Comment #7
monsoon commentedI am facing similar issue with Drupal 7. I have used Field Collection Items in profile2 type. And now created a users' view.
When I add relation between Profile 2 type and Field Collection Item and later add the field from field collection item to the views fields I get duplicate rows.
Please help how can your code work there. I am not a programmer.
Thanks.