Hello, I'm a big fan of the View module, so I always use it for much every thing... ^^

But I can't find to do something i'm really need:

I have two node-type A and B.
I've put a CCK nodereference into B where users choose wich node is the node reference.

In Views module I'm ordering nodes B , using the title of the node reference (A) and fields from B.
But I would like to use fields from A too without usind node A in general.

But the problem is that I can't add fields from A.

Maybe I simply can't...
Maybe I have to insert fields A into B but It's a waste a time for users... and I really need to add the votingapi fields from A
I want to use the votingapi result of the node A witch corresponds to the node reference into B...

I really lost right now... I don't know how to do this...

Any idea?

A simple help to put me in the right path will be very appreciate ^^.

Thanks

Julien

Comments

merlinofchaos’s picture

Priority: Critical » Normal
Status: Active » Fixed

You want to add a relationship on the nodereference. Under relationships, choose add. Under the content group you should find a list of all your node references. Select the one you want. Once the relationship is added, all fields, filters, arguments and sort criteria can now choose which relationship they will use. Items using the relationship will take fields from the referenced node instead of the node being listed.

junro’s picture

Thanks to reply so quickly ^^ :)

I was in the right path, but as, I'm trying only with votingapi... I didn't know that all the rest worked good.
So thanks for this.

But how use votingapi with a node reference... as votingapi needs by defaut a relationship....

Well I'm going to create a new issue in Votingapi if I don't find how to do this ^^.

Thanks again ^^

Julien

merlinofchaos’s picture

You can chain relationships. SO you can add in the nodereference relationship and set that as the base relationship for the votingapi relationship.

junro’s picture

Sorry but I don't find how doing this...

When I add in "Relationship": "Node : Voting results" I can't choose to put it in another relationship...

Can you explain: "you can add in the nodereference relationship and set that as the base relationship for the votingapi relationship" as I was a newbie please ^^.

Maybe I have to use in my nodes, a votingapi result of the user votes... maybe I can only use content fields... I don't display the votingapi result into nodes yet... I only display iot with View module.

mooffie’s picture

Status: Fixed » Postponed (maintainer needs more info)

When I add in "Relationship": "Node : Voting results" I can't choose to put it in another relationship...

I've just had a peek at VotingAPI's source code and I see that it uses the 'relationship field' definition. This will indeed cause the "Relationship:" dropdown to not show up (or to not include all the possible relationships), and I've just reported about this:

#316195: "Relationship:" dropdown isn't built correctly

(Junro, could you please test that patch and, if it solves your problem, mark this issue "duplicate"?)

junro’s picture

To Mooftie,
I never apply patches, so I'm going to do this by changing myself the Views folder but...
Do you know witch folder I have to modify?
I would really like your patch works ^^

ps:
- if (isset($base_fields[$handler->table . '.' . $handler->field])) {
+ if (isset($base_fields[$item['table'] . '.' . $item['field']])) {

- if (isset($base_fields[$handler->table . '.' . $handler->field])) {
+ if (isset($base_fields[$item['table'] . '.' . $item['field']])) {

I've only got these 2 changes to apply?

mooffie’s picture

Junro, that patch got committed, so you don't need to apply it yourself: download the 'dev' version and check whether you now see the "Relationship:" dropdown,

junro’s picture

Hi, just downloading the dev version of votingapi and there is no "Dropdown" in Relationship...

junro’s picture

Hi, oups newbie I am, just downloading the dev version of Views.... It's perfect!!!!!!!!!! Just testing few minutes and everythnig mooks like to work fine ^^.

Thanks :)

mooffie’s picture

Status: Postponed (maintainer needs more info) » Fixed

Great. So let's mark this 'fixed'.

junro’s picture

I don't know if I have to create a new issue or not but I miss a last thing to do exactly what I want, and I think it's very important for those who want to use Votingapi with a nodereference:

I would like to put in "argument" the user who cast the vote (using the votingapi of the nodereference).

If I can't select that, my table view will displaying all the user who cast a vote...
If I choose "Current user only"... it's good but I need to display the view for each user into their profiles and that everbody could see it. User A could see the View of user B into the profile of User B.

If that I say is not understanding... just tell me and I will try to explain with a better english ^^ (I will try... not quickly but I will)

merlinofchaos’s picture

Junro: You might post that as a support question in the voting api queue. I *think* votingapi supplies the proper relationships to be able to do that, but I'm not certain.

eaton’s picture

This is possible using the new current-user default option for the uid field -- bookmarking this thread so I can come back and post something with a bit more detail this afternoon.

junro’s picture

Hi Eaton & Merlin,

I create a the issue in VotingApi at:

http://drupal.org/node/316792

Thanks :)

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.