Views and to-many relationship (in service output)

Hi experts!
I have a Drupal installation (newest of 6 branch) with cck, views and service modules installed.
I'm building a application with a drupal backend and a Flex client. So I want to exchange data. Everythings works fine except one thing:

The service output of to-many relations is weird. I have 2 content types: Artist and Video. Each video can have 1 or more related Artists.
I have 2 artists and two videos. the second video has BOTH artsts attached.

Video1 (nid: 10)
 - Artist 1
Video 2 (nid: 12)
 - Artist 1
 - Artist 2

The result looks like this:

Array
(
    [0] => stdClass Object
        (
            [nid] => 10
            [node_title] => Interview with Metallica
            [node_node_data_field_related_artists_node_data_field_artist_name_field_artist_name_value] => Metallica
            [node_node_data_field_related_artists_nid] => 9
            [node_node_data_field_related_artists_type] => artist
            [node_node_data_field_related_artists_vid] => 9
            [node_node_data_field_related_artists_node_data_field_artist_name_field_artist_genre_value] => Thrash Metal
            [node_node_data_field_related_artists_title] => Metallica - Biggest Metal Band ever
        )

    [1] => stdClass Object
        (
            [nid] => 12
            [node_title] => Mixed Interview
            [node_node_data_field_related_artists_node_data_field_artist_name_field_artist_name_value] => Slipknot
            [node_node_data_field_related_artists_nid] => 11
            [node_node_data_field_related_artists_type] => artist
            [node_node_data_field_related_artists_vid] => 11
            [node_node_data_field_related_artists_node_data_field_artist_name_field_artist_genre_value] => NuMetal
            [node_node_data_field_related_artists_title] => Chaos Metal Head from Iowa
        )

    [2] => stdClass Object
        (
            [nid] => 12
            [node_title] => Mixed Interview
            [node_node_data_field_related_artists_node_data_field_artist_name_field_artist_name_value] => Metallica
            [node_node_data_field_related_artists_nid] => 9
            [node_node_data_field_related_artists_type] => artist
            [node_node_data_field_related_artists_vid] => 9
            [node_node_data_field_related_artists_node_data_field_artist_name_field_artist_genre_value] => Thrash Metal
            [node_node_data_field_related_artists_title] => Metallica - Biggest Metal Band ever
        )

)

Open in new window


The "nid" of the second and third entry is the same.
I want just 2 items in the array. The second one should have an array with all related artists.

Is that related to the delta settings? I didn't find detailed information on "delta". But playing around with it doesn't solve my issue. Then only one of the two artists is included. That sucks. What I'm I doing wrong?

Thanks in advance!
Simon
simonwidjajaAsked:
Who is Participating?
 
Thomas4019Connect With a Mentor Commented:
wow my bad, this is the link I meant to send, http://groups.drupal.org/node/72553#comment-272429.

pretty much there is no great solution, yes. People moan about the views duplicates problem over and over again and find a few workarounds but there is no one great solution. If you click on your relationship in views, under delta you will see this message ,

"The delta allows you to select which item in a multiple value field to key the relationship off of. Select "1" to use the first item, "2" for the second item, and so on. If you select "All", each item in the field will create a new row, which may appear to cause duplicates."

The best solution is probably to merge the multiple rows back into one within flex.
0
 
Thomas4019Commented:
It's a known problem, when you setup anview with a many to one relationship where the delta is set to "all", duplicates appear. What happens is each value in the many to one relationship creates a new row. Looking at your screenshot, I see the nid 12 is included twice. You could probably manually join the on the flex end. Or google views duplicates to see others solutions. Here's one related thread, http://drupal.org/project/dhtml_menu.
0
 
simonwidjajaAuthor Commented:
so there is NO solution?

I don't get the link you posted. Where is the connection between Views and DHTML?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.