CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviReport (Moderator: Dave Greenberg) »
  • How to set sort order in Donor Report
Pages: [1]

Author Topic: How to set sort order in Donor Report  (Read 746 times)

TheoRichel

  • I post frequently
  • ***
  • Posts: 122
  • Karma: 0
  • CiviCRM version: 4.2.1
  • CMS version: Drupal 6.24
  • MySQL version: 5.9
  • PHP version: 5.3.16
How to set sort order in Donor Report
August 11, 2011, 02:08:59 am
There is an attractive 'Donor Report' in the Dashboard that shows a vertical bar for each month of donations. However I would very much like to see the last month first instead of the first month (which is several years ago) to save me scroilling to the right each time.
This will probably mean to set something from ascending to descending, but where?

Rajan Mayekar

  • I post frequently
  • ***
  • Posts: 177
  • Karma: 20
    • Rajan's Blogs
Re: How to set sort order in Donor Report
August 11, 2011, 03:17:17 am
Yes, u can do this by following minor changes

Code: [Select]
Index: CRM/Report/Form/Contribute/Summary.php
===================================================================
--- CRM/Report/Form/Contribute/Summary.php (revision 35683)
+++ CRM/Report/Form/Contribute/Summary.php (working copy)
@@ -365,12 +365,12 @@
                             if ( CRM_Utils_Array::value('frequency', $table['group_bys'][$fieldName]) &&
                                  CRM_Utils_Array::value($fieldName, $this->_params['group_bys_freq']) ) {
                                 
-                                $append = "YEAR({$field['dbAlias']}),";
+                                $append = "YEAR({$field['dbAlias']}) DESC,";
                                 if ( in_array(strtolower($this->_params['group_bys_freq'][$fieldName]),
                                               array('year')) ) {
                                     $append = '';
                                 }
-                                $this->_groupBy[] = "$append {$this->_params['group_bys_freq'][$fieldName]}({$field['dbAlias']})";
+                                $this->_groupBy[] = "$append {$this->_params['group_bys_freq'][$fieldName]}({$field['dbAlias']}) DESC";
                                 $append = true;
                             } else {
                                 $this->_groupBy[] = $field['dbAlias'];

Rajan

TheoRichel

  • I post frequently
  • ***
  • Posts: 122
  • Karma: 0
  • CiviCRM version: 4.2.1
  • CMS version: Drupal 6.24
  • MySQL version: 5.9
  • PHP version: 5.3.16
Re: How to set sort order in Donor Report
August 11, 2011, 04:47:14 am
Perfect! Thanks a million!

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviReport (Moderator: Dave Greenberg) »
  • How to set sort order in Donor Report

This forum was archived on 2017-11-26.