How do you use views to just list the total number of specific published content type for the day? Like, if I posted 20 articles on a given day, how would I output a view that just said something like "20 articles published today."

Comments

bojanz’s picture

Status: Active » Fixed

Create a view.
Add a filter: "Node: post date", set it to "greater than" : "-1 day". This will show all items created in the last 24h (Views doesn't really understand "today").
You can also filter by node type, to show just articles and not all nodes.
Enable grouping (Use Grouping: Yes, in the first column under the heading "Advanced Settings")
Add the field Node: nid. When asked for "Group type", select "Count".
In the next screen, enable "Rewrite the output of this field" and in the textbox bellow enter "[nid] articles published today". You have "Replacement patterns" bellow that textbox giving you all the patterns you can use.

That should be it. Let me know if you need additional help.

htalwala’s picture

Thanks a lot for that... I will implement it soon and let you know how it goes.

leoklein’s picture

Ah 'count'! Helpful to me as well.

Status: Fixed » Closed (fixed)

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

GlitchFreak’s picture

Excuse my ignorance, but where do I enable grouping in my view? There is no 'advanced settings ' column.

GlitchFreak’s picture

Status: Closed (fixed) » Active
bojanz’s picture

Status: Active » Closed (fixed)
StatusFileSize
new124.99 KB

See image.

GlitchFreak’s picture

Ah, its D7.

Any idea on how to achieve this in D6?

bojanz’s picture

The same. You just need Views 3 (not Views 2). Use the dev version, not that year old alpha3.

yeniv’s picture

Version: 7.x-3.x-dev » 7.x-3.0-rc1
StatusFileSize
new106.71 KB

I'm using views 7.x-3.0-rc1 and having trouble getting it to work.

I've followed all the steps, although in my views it's called 'use aggregation' instead of 'grouping' (i assumed this was the same thing?)

I'm getting a result for each of my content belonging to the content type 'item'. They don't seem to be grouping together and the count = 1 for all of them.

I've only been drupaling for a week. Sorry for the noobness. Please help.

bojanz’s picture

Update Views to 7.x-3.x-dev. Less bugs.

I've followed all the steps, although in my views it's called 'use aggregation' instead of 'grouping' (i assumed this was the same thing?)

Yes.

I can't see the generated query (should be in the preview area if you enabled it in the "Advanced" tab of admin/structure/views), so you'll have to provide it, and give me a view export so that I can help you further.

yeniv’s picture

StatusFileSize
new46.61 KB

@bojanz thanks for the speedy reply!

I have 6 content types which fall under the category of 'item'. As you can see, i get an identical result for each content type.

bojanz’s picture

As I said:

I can't see the generated query (should be in the preview area if you enabled it in the "Advanced" tab of admin/structure/views), so you'll have to provide it, and give me a view export so that I can help you further.

You're not giving me any info.

yeniv’s picture

I apologise. Here is the generated query:

SELECT node.created AS node_created, COUNT(node.nid) AS nid
FROM 
{node} node
WHERE (( (node.status = '1') AND (node.type IN  ('item')) ))
GROUP BY node_created
ORDER BY node_created DESC
LIMIT 10 OFFSET 0
yeniv’s picture

Hey bojanz, any idea where i've gone wrong? Thanks :)

yeniv’s picture

I figured it out. I didn't have my SORT CRITERIA 'Aggregation settings' set to COUNT.