0

I enable the calendar module, then "Add view from template" on /admin/structure/views/add-template, but I cannot count nodes published at the same day in the month view by following this tutorial. I want events occurred in the same day can be counted like "3 events occurred" other than the original output in the red box, and the counted field can be rewritten. enter image description here

I tried aggregation feature of views, but no luck.

1 Answer 1

1

Finally, I get it working. After I turn on View's setting "Show the SQL query", I notice there is an unnecessary GROUP BY field "nid" in the Calendar view, then I unset this field in a hook_query_alter(QueryAlterableInterface $query) as below:

if ($query->hasTag('views_' . $view_name)) {
    $fields =& $query->getGroupBy();
    unset($fields['nid']);
}
1
  • fishfree, please add detalis on how you did manage to count results, i allready unset group by nid, but i cant go further, i tryed aggregation, no luck, i override every teamplate in month-calendar view and nothing.
    – pinueve
    Commented Apr 4, 2020 at 17:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.