Hi,
Sounds stupid but I can't manage to create a view that count the number of node of a certain type each user created.
Any clue?
Cheers,
Denis
http://drupal.org/project/views_calc
Shai Gluskin
On Dec 22, 2010, at 3:23 AM, Denis Lafont-Trevisan denis.lafont@gmail.com wrote:
Hi,
Sounds stupid but I can't manage to create a view that count the number of node of a certain type each user created.
Any clue?
Cheers,
Denis
[ Drupal support list | http://lists.drupal.org/ ]
Hi,
Just for the archive, the answer was using Views GroupBy module.
Cheers,
Denis
On Wed, Dec 22, 2010 at 12:36 PM, Shai Gluskin shai@content2zero.comwrote:
On Dec 22, 2010, at 3:23 AM, Denis Lafont-Trevisan denis.lafont@gmail.com wrote:
Hi,
Sounds stupid but I can't manage to create a view that count the number
of node of a certain type each user created.
Any clue?
Cheers,
Denis
[ Drupal support list | http://lists.drupal.org/ ]
-- [ Drupal support list | http://lists.drupal.org/ ]
Is there any solution NOT involving COUNT() ?
Otherwise the Drupal Handbook (http://drupal.org/node/161974) has the most straightforward PHP snippet:
<?php $mytype = 'job'; // <<---------- set your content type here. $results = db_query("SELECT COUNT(DISTINCT(nid)) FROM {node} WHERE type='%s' AND status=1", $mytype); $count = db_num_rows($results); echo "There are currently $count jobs in our database."; ?>
Victor Kane http://awebfactory.com.ar http://projectflowandtracker.com
On Wed, Dec 22, 2010 at 11:16 AM, Denis Lafont-Trevisan < denis.lafont@gmail.com> wrote:
Hi,
Just for the archive, the answer was using Views GroupBy module.
Cheers,
Denis
On Wed, Dec 22, 2010 at 12:36 PM, Shai Gluskin shai@content2zero.com wrote:
On Dec 22, 2010, at 3:23 AM, Denis Lafont-Trevisan < denis.lafont@gmail.com> wrote:
Hi,
Sounds stupid but I can't manage to create a view that count the number
of node of a certain type each user created.
Any clue?
Cheers,
Denis
[ Drupal support list | http://lists.drupal.org/ ]
-- [ Drupal support list | http://lists.drupal.org/ ]
-- [ Drupal support list | http://lists.drupal.org/ ]
Le mercredi 22 décembre 2010 à 09:23 +0100, Denis Lafont-Trevisan a écrit :
Hi,
Sounds stupid but I can't manage to create a view that count the number of node of a certain type each user created.
What are you really trying to do? This sounds quite stupid to use views only to count something. Are you really willing to consume 10M of memory and 100ms of execution time to only do a COUNT query?
Pierre.
Suppose you want to make a "ranking" of contributors, being able to sort them. search by name, etc...
I think the best way is using Views GroupBy module, using PHP won't allow you to sort the results.
If performance is important, you could cache the results in a table using cron and just show them when needed.
2010/12/22 Pierre Rineau pierre.rineau@makina-corpus.com:
Le mercredi 22 décembre 2010 à 09:23 +0100, Denis Lafont-Trevisan a écrit :
Hi,
Sounds stupid but I can't manage to create a view that count the number of node of a certain type each user created.
What are you really trying to do? This sounds quite stupid to use views only to count something. Are you really willing to consume 10M of memory and 100ms of execution time to only do a COUNT query?
Pierre.
-- [ Drupal support list | http://lists.drupal.org/ ]
He's counting, there are no results to count
On Wed, Dec 22, 2010 at 3:48 PM, Lluís Forns enboig@gmail.com wrote:
Suppose you want to make a "ranking" of contributors, being able to sort them. search by name, etc...
I think the best way is using Views GroupBy module, using PHP won't allow you to sort the results.
If performance is important, you could cache the results in a table using cron and just show them when needed.
2010/12/22 Pierre Rineau pierre.rineau@makina-corpus.com:
Le mercredi 22 décembre 2010 à 09:23 +0100, Denis Lafont-Trevisan a écrit :
Hi,
Sounds stupid but I can't manage to create a view that count the number of node of a certain type each user created.
What are you really trying to do? This sounds quite stupid to use views only to count something. Are you really willing to consume 10M of memory and 100ms of execution time to only do a COUNT query?
Pierre.
-- [ Drupal support list | http://lists.drupal.org/ ]
-- *Les normes hi són perquè hi pensis abans de saltar-te-les *La vida és com una taronja, què esperes a exprimir-la? *Si creus que l'educació és cara, prova la ignorància. *La vida és com una moneda, la pots gastar en el que vulguis però només una vegada.
*Abans d'imprimir aquest missatge, pensa en el medi ambient.
[ Drupal support list | http://lists.drupal.org/ ]
Right now I work with large databases, so to make count() and sum() I have to calculate all the data using a batch and then list it using views. But for small databases and simple queries, it isn't necessary.
2010/12/22 Victor Kane victorkane@gmail.com:
He's counting, there are no results to count
On Wed, Dec 22, 2010 at 3:48 PM, Lluís Forns enboig@gmail.com wrote:
Suppose you want to make a "ranking" of contributors, being able to sort them. search by name, etc...
I think the best way is using Views GroupBy module, using PHP won't allow you to sort the results.
If performance is important, you could cache the results in a table using cron and just show them when needed.
2010/12/22 Pierre Rineau pierre.rineau@makina-corpus.com:
Le mercredi 22 décembre 2010 à 09:23 +0100, Denis Lafont-Trevisan a écrit :
Hi,
Sounds stupid but I can't manage to create a view that count the number of node of a certain type each user created.
What are you really trying to do? This sounds quite stupid to use views only to count something. Are you really willing to consume 10M of memory and 100ms of execution time to only do a COUNT query?
Pierre.
-- [ Drupal support list | http://lists.drupal.org/ ]
-- *Les normes hi són perquè hi pensis abans de saltar-te-les *La vida és com una taronja, què esperes a exprimir-la? *Si creus que l'educació és cara, prova la ignorància. *La vida és com una moneda, la pots gastar en el que vulguis però només una vegada.
*Abans d'imprimir aquest missatge, pensa en el medi ambient.
[ Drupal support list | http://lists.drupal.org/ ]
-- [ Drupal support list | http://lists.drupal.org/ ]
On Wed, 2010-12-22 at 19:48 +0100, Lluís Forns wrote:
Suppose you want to make a "ranking" of contributors, being able to sort them. search by name, etc...
I think the best way is using Views GroupBy module, using PHP won't allow you to sort the results.
If performance is important, you could cache the results in a table using cron and just show them when needed.
Oh I see, this is more than just a count. If you don't find any views plugin that allows you to do so, you can do a simple request using views, configure your listing and exposed filters, then alter the query or make your own views filter or such that could complete the query to do exactly what you want to.
Views is a query builder, and it's not that good in building complex queries with multiple tables, you can often get what you want but often not in a "obvious" way, you sometimes have to trick views to get what you want. In most case I end up by giving up with views and writing my own queries in custom code. At least, I don't have to search hours to find the exact and only way to do it with such module, write my own query often take less than a minute to get exactly what I want.
Pierre.