views:

27

answers:

1

I have a content types with 3 file fields, all of them can have an unlimited number of images. I need to make a view that returns the title of the content and the images name inside an array (I'm using amfphp with services). The problem is that when I add the relationship to the content field_pics fid I get as many duplicate nodes as the number of the images in the field:

EG:

[10] => stdClass Object
    (
        [nid] => 56
        [node_title] => asd asd asd
        [node_language] => 
        [node_nid] => 56
    )

[11] => stdClass Object
    (
        [nid] => 56
        [node_title] => asd asd asd
        [node_language] => 
        [node_nid] => 56
    )

This is the query:

SELECT node.nid AS nid, node.title AS node_title, node.language AS node_language, node.nid AS node_nid 
FROM node node  
LEFT JOIN content_field_colori node_data_field_colori ON node.vid = node_data_field_colori.vid 
LEFT JOIN files files_node_data_field_colori ON node_data_field_colori.field_colori_fid = files_node_data_field_colori.fid 
WHERE (node.status <> 0 OR (node.uid = ***CURRENT_USER*** AND ***CURRENT_USER*** <> 0) OR ***ADMINISTER_NODES*** = 1) AND (node.type in ('prodotto')) 
ORDER BY node_nid ASC

I don't know how to fix this.

ANy help is appreciated.

Thanks

+1  A: 

I think I understand what you're trying to do now. Unfortunately, Services's views support isn't all that great when it comes to CCK. There are a lot of different issues (e.g. one, two, three) with a lot of different patches and comments, but based on my understanding, to capture what you want is to not use relationships and to use the Node row style. If you use relationships, you get the output you're seeing, and if you use the Fields row style, the ImageField fields never load.

Mark Trapp
I don't know how you managed to understand the problem. Thank you! I wasn't aware of the limitation of the Services I'm reading your links, meanwhile I'm using the node style. :-)
0plus1

related questions