I know this must be a basic question but I can't find the answer after several attempts of searching google and drupal...
I'm a drupal rookie
I have a hosted version of Drupal 6.15
I have installed Views 6.x-2.10
I built a view to display nodes of a custom content type I created. Right now, my view is displaying all revisions of the nodes. I only want to display the current revision.
I have searched the group options under the filter, particularly Node and Node Revision. I have also scanned the complete list of options for filter constructs. I cannot see anything that allows me to build this type of filter (node revision status = "Current", or something....) but I know there must be a straightforward way to do it. Help?
Comments
It sounds like you are using
It sounds like you are using fields, relationships or filters from the Node Revision part of the available fields. Remove that and use the fields from the Node part.
thanks, but I'm having trouble understanding the advice...
I do not have any relationships set with this view.
I edit the view and click the (+) in the filters section to add a filter condition. In the Groups drop down I select: Node (I think this is what you mean by "use the fields from the Node part). I see these options:
Node: Body
Node: Comment count
Node: Comment status
Node: Has new content
Node: Last comment time
Node: Moderated
Node: Nid
Node: Post date
Node: Promoted to front page
Node: Published
Node: Published or admin
Node: Sticky
Node: Teaser
Node: Title
Node: Type
Node: Updated date
Node: Updated/commented date
Node: User posted or commented
None of these seem to address the "is this the current revision" condition.
I have only ever seen the
I have only ever seen the Node Revision group cause multiple entries if you aren't using relationships. Can you post the SQL query it creates in the views preview section?
view sql
thanks for sticking w/ it. The content_type_submitted_site is my custom type.
SELECT node.nid AS nid,
node.title AS node_title,
node_data_field_site_url.field_site_url_url AS node_data_field_site_url_field_site_url_url,
node_data_field_site_url.field_site_url_title AS node_data_field_site_url_field_site_url_title,
node_data_field_site_url.field_site_url_attributes AS node_data_field_site_url_field_site_url_attributes,
node.type AS node_type,
node.vid AS node_vid,
node_data_field_site_url.field_status_value AS node_data_field_site_url_field_status_value,
node.created AS node_created,
users.name AS users_name,
users.uid AS users_uid
FROM node node
LEFT JOIN content_type_submitted_site node_data_field_site_url ON node.vid = node_data_field_site_url.vid
INNER JOIN users users ON node.uid = users.uid
WHERE node.type in ('submitted_site')
ORDER BY node_data_field_site_url_field_site_url_url ASC
looking at the fields it
looking at the fields it used, i think it's caused by the view type. on /admin/build/views, see if it says 'Normal Node view' or 'Normal Node revision view' [view name]. my guess is that it's set to Node revision view, when you want one that's a Node view.
it is a Normal Node View
looking at the View list, this one is indicated as a Normal Node View
Can you do this: tell me how this should work if I created a new view. For example:
Administer / Views / Add
View name: my_test
View Type: Node
Next
Filters add (+)
Groups: Node...?
In the new view under
In the new view under Filters/Node, try Node:Type to restrict to the desired type. You should see every unique node in the Preview with no duplicates. If this works, we'll switch the view type to Fields and add Node: Title and and Node:NID. The we'll add your CCK fields one at a time until we start getting dupes.
I'm very embarrassed...
Using the steps you just suggested I found the source of my problem: the data that looked like two revisions of the same node was really two nodes. I don't recall how that could have happened. I did try to validate this a couple of days ago but I didn't catch it.
In case anybody is confused by the same point I was initially:
How do you filter to get the last revision of a node in a view?
The answer is pretty straightforward: if you create a view of type=Node, you will get the current revision by default. I think that is correct?
Thanks for the help. Really sorry for the goose chase.
Occam's Razor wins again, eh?
Occam's Razor wins again, eh? You did a good job of providing information and following troubleshooting advice without skipping steps; those are the kinds of questions that get answered on the forums, so be sure to do that again when you have future questions! It's also good practice to edit your original post title and add [RESOLVED] so others won't think it's an open issue.
You get the current published
You get the current published revision, not the latest revision (if you're using content moderation)