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) »
  • A report with only filters
Pages: [1]

Author Topic: A report with only filters  (Read 933 times)

matthewboh

  • I post occasionally
  • **
  • Posts: 89
  • Karma: 2
A report with only filters
June 22, 2012, 01:34:46 pm
I need to create a report based on age groupings, so I just want to allow for certain filters on Groups and Tags. However, it's showing up custom fields in the selection field. See the attachment for a screenshot.

If I could get the "Additional Fields" out of the Display section but keep it in the filter section, that would be totally excellent!

Here's my code

Code: [Select]
    protected $_customGroupExtends = array(
    'Contact', 'Individual'); function __construct() {
    $this->_columns = array(
      'civicrm_group' =>
      array(
        'dao' => 'CRM_Contact_DAO_Group',
        'alias' => 'cgroup',
        'filters' =>
        array(
          'gid' =>
          array(
            'name' => 'group_id',
            'title' => ts('Group'),
            'operatorType' => CRM_Report_Form::OP_MULTISELECT,
            'group' => TRUE,
            'options' => CRM_Core_PseudoConstant::group(),
          ),
        ),
      ),
    );

    $this->_tagFilter = TRUE;
    parent::__construct();
  }


Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: A report with only filters
June 24, 2012, 05:28:23 am
I have done this in a report to get the event filter only:
Code: [Select]
        $this->_columns =
            array( 'civicrm_participant' =>
array( 'dao' => 'CRM_Event_DAO_Participant',
   'filters'  =>
array( 'event_id'
=> array( 'name'         => 'event_id',
                                  'title'        => ts( 'Event' ),
                                  'operatorType' => CRM_Report_Form::OP_MULTISELECT,
                                  'options'      => $_events['all'] ),
                                ),
                         ),
                  );
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

britebyte

  • I post occasionally
  • **
  • Posts: 70
  • Karma: 2
  • CiviCRM version: Several 3.4+, 4.1+
  • CMS version: Drupal 6, Drupal7
  • MySQL version: Several 5.1+
  • PHP version: Several 5.2+
Re: A report with only filters
June 25, 2012, 05:11:22 pm
If you have
Code: [Select]
$_customGroupExtends = array('Contact', 'Individual') you will get the custom fields added in the criteria.
If you don't want those you will have to override addCustomDataToColumns and perhaps buildQuery or customDataFrom to get things to work just right.

matthewboh

  • I post occasionally
  • **
  • Posts: 89
  • Karma: 2
[Closed] Re: A report with only filters
July 01, 2012, 10:34:11 am
Thanks! Between the two of you, figured out to take out the $_customGroupExtends statement and I got what I wanted.

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: A report with only filters
July 02, 2012, 11:56:12 pm
Glad it worked Matthew  :D
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviReport (Moderator: Dave Greenberg) »
  • A report with only filters

This forum was archived on 2017-11-26.