Hey all,

I'm playing around with this module and i was wondering if i can create a view that shows only nodes that have a attached view and to make it even more complicated: sorted on the post date from that attached node or the newest attached node.

I just want to create a view so people can see there have been added new articles to the main article. (so sorting on new attached articles but i want to show the main article)

Perhaps somebody has a idee how i could complete this?

Comments

Crell’s picture

I don't know what you mean by "sorted on the post date of the attached node". You can sort by post date, but it sounds like what you actually mean is filtered to only show nodes whose updated date is after that of the attached node.

I'm not sure if that's possible, unfortunately. At least I cannot think of a way to do so.

janton’s picture

No No.. i mean normally you can add a Node Post date to the Sorting system in view.
What i want to do is sort the articles not on the post date of the "main" article but sort on the article i attached to it!

i hope you understand it now :) for example i have a article about Tigers i attached a article on it about the Forrest
In my View i only want to show the Tiger article but Sorted with the Post date of the Forrest.

Also if the Tiger article did not have any attached articles i don´t want to see it. (only show when articles are attached)

Crell’s picture

Now I'm even more confused.

So you have:

Node type: Animal
Node type: Place

Place has a noderef pointing to Animal.

On an Animal node, you want to show all Places that point to that animal... sorted by the post date of the animal? That doesn't make any sense at all.

If that's not what you mean (I presume not), please describe what you're talking about in more precise terms as above.

I think you may be confusing the nodereferences involved completely.

kclarkson’s picture

I have a similar situation where I need to filter the "attached" view to show only nodes of upcoming workshops based on the "now" timeframe.

Basically I have events. But I also have attached views for events that are similar by taxonomy. Problem is that it shows all events even ones that have passed.

Crell’s picture

Again, that has nothing to do with views attach. You just need to setup a filter on the date field you want and restrict it to "date > now".

kclarkson’s picture

Crell,

Have you actually tried the date filter with views attach? Reason I ask is because my filter works great with the page, block and other displays but with the "content pane", and views attach it doesn't.

Thanks,

Crell’s picture

I can't see why it wouldn't. If you can, provide an export of the view you're trying to use, and a description of the content types so that I can try to replicate it.

janton’s picture

Crell sorry for my late respons, i will try to explain better:
To start, yes you understood wrong i hope i make the explenation better this time!

I have a Node Type: Animals
and Node type: Places

I write a article about about a Tiger, and i call it Tiger. (node type Animals)
Later i write a article about the Forrest and make a nodereference/view attach to the Tiger story (node type Places)
Now when i read the article Tiger i see the attached article Forrest below.

Now we are at my question/problem:
So i want to create a View for my frontpage:
-Filter:Show Node Type "Animals"
-Sorted: Post date Node Type "Places"
*-Filter: Don't show article Node Type "Animals" if it has no attached article
I don't want to see any articles of the Node type "Places" in this View, only want to see the "Animals".

So now when i go to my frontpage, the view shows the story Tiger AND sorted on the post date of the attached article Forrest.

No when i add more Animals; Horses , Cats , Dogs
IF i don't attach any "Places" i don't want to see that article in this view. (so now i would only see the Tiger story because it has a attached view about the Forrest)

If i attach a article to Dogs Cats Horses. I go to my frontpage and i see Dogs, Cats, Horses, Tigers sorted on the date of the last/newest attached "Places" story of THAT article.

You say:
"On an Animal node, you want to show all Places that point to that animal... sorted by the post date of the animal? That doesn't make any sense at all."

No i want to make a View with ALL Animal nodes (node type Animals) and those nodes are sorted on the Date of the attached article.
Only problem i think about is when a article has multiple articles attached... so i was hoping it would take the last/newest article as main Date.

talatnat’s picture

Since I'm trying to only partly do what the original posting is suggesting, I thought I'd ask here without starting another thread or hijacking this one.
I have a content-type 'Story' and another called 'Story Updates'; nodes in Story Updates point via a nodereference field to their parent Story node. Both use Views fields. When I display a Story node, I use Views Attach to append that story's updates to it at the bottom. This works fine.
However, on a homepage or other View, when a story node appears (as a full node but as part of a list), it does not have the attached story updates. I now provide each node in a homepage view with a link to the node so that users can view the node by itself along with it's story updates (which is repetitous).
Question: Is it possible to attach a view to nodes that are part of another view (by an argument or a relationship or a backreference)? If not, can I at least provide the node title link only to those stories that have story updates attached (right now they all have the link).
I have gone around in circles on this... any pointers will be greatly appreciated.

Crell’s picture

Project: Views attach » Views (for Drupal 7)
Version: 6.x-2.2 » 6.x-2.9
Status: Active » Fixed

janton: OK, it sounds like what you're doing doesn't involve Views Attach at all, just nodereferences. Views Attach is purely a display tool for injecting a view onto a node type's display. As soon as you said "show on the front page" you left Views Attach land. The fact that you're using Views Attach to show Forests that point to Tigers on the Tiger page is irrelevant to any other view.

So really this is a general Views support question, not a Views Attach question at all.

Given that, the problem you're running into is that nodereference is a one-way relationship. From an animal node there is no way to get "place nodes that point to me" from within Views itself; Views Attach does so using an argument, which is I suspect where your confusion of its purpose comes from.

In your case, you may be able to get what you want by instead making a view of all Place nodes, ordering by date, and then adding a Relationship on the nodereference from Place to Animal. Then for Fields, select only fields from Animal nodes. You may well get duplicates from that approach, so try using the DISTINCT flag on the View. That's the best I can offer, really.

talatnat: Please file such requests as a separate issue in the future, as that is actually a different matter. For your case, you can attach a Node Content display from Views Attach to a node teaser, and then make a teaser view somewhere. There is no way to attach a view to a Field view, unfortunately.

talatnat’s picture

Thank you -- that answers why I went around in circles and my confusion in thinking it was related to the OP. Sorry about posting here.

janton’s picture

Crell, sorry i got confused i guess. Now i understand what you mean views attach is just a display tool, so i would be have been more in place to ask this at nodereferences... but i will first try your approach! (tomorrow)

Status: Fixed » Closed (fixed)

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