Using Query Projections to Count Content Items

Topics: Administration, Customizing Orchard, Troubleshooting
Jun 27, 2013 at 11:44 PM
Edited Jun 27, 2013 at 11:45 PM
I am trying to set up a dashboard to display a simple count of a specific content item in its various states, toggled by an enumeration field within the content type. As it changes I would like the dashboard to update the count. So, it would read: "Completed: #, Active: #, Voided: #. What would be the best way to go about doing this? I am familiar with using projection layouts to render queried data in different ways, but I don't see a token to simply "count". Can someone provide a simple way to do this? Thanks. :)
Jun 28, 2013 at 7:17 PM
There is no built-in feature for this. However you could write a module that queries the content items in question and computes these values. Samples for such queries are here.

Regarding Projections and counting you might be looking for a feature outlined in this issue.