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) »
  • OP_DATE used to try to filter by date
Pages: [1]

Author Topic: OP_DATE used to try to filter by date  (Read 701 times)

miletus

  • I’m new here
  • *
  • Posts: 8
  • Karma: 0
  • CiviCRM version: 4.0
  • CMS version: drupal 7
  • MySQL version: 5.1.52
  • PHP version: 5.2.17
OP_DATE used to try to filter by date
December 20, 2011, 09:40:00 pm
Hi, I would like to create a report that shows all the events for a particular date, lists all the participants for each of the events on that date and a summary count  for each event of the total enrolled participants.

I followed a similar path as in:
http://forum.civicrm.org/index.php/topic,20217.msg84531.html#msg84531
and attempted to add a filter criteria to the ParticipantList report for event start date. 
                         
Code: [Select]
array( 'operatorType' => CRM_Report_Form::OP_DATE ),
  ),
     

And had the expectation that the  CRM_Report_Form::OP_DATE  provided date filtering capabilities.  Can someone comment if OP_DATE provides this capability, and if yes, how to access its capabilities?
Here was my attempt to add  a date filter to my custom template using ParticipantListing.php as the model to add filtering for start_date :
Code: [Select]
                 array( 'dao'        => 'CRM_Event_DAO_Event',
                         'fields'     =>
                         array(
                               'event_type_id' => array( 'title' => ts('Event Type') ),
                               'start_date' => array( 'title' => ts('Start date bdc') ),                               
                               ),
                         'grouping'  => 'event-fields',
                         'filters'   =>             
                         array(                     
                               'eid' =>  array( 'name'         => 'event_type_id',
                                                'title'        => ts( 'Event Type' ),
                                                'operatorType' => CRM_Report_Form::OP_MULTISELECT,
                                                'options'      => CRM_Core_OptionGroup::values('event_type') ),
                               'start_date' => array( 'title'        => ' Start Date',
                                                                      'operatorType' => CRM_Report_Form::OP_DATE ),                   

Thanks.

Deepak Srivastava

  • Ask me questions
  • ****
  • Posts: 677
  • Karma: 65
Re: OP_DATE used to try to filter by date
December 20, 2011, 10:09:47 pm
Yes OP_Date does provide filter capabilities, however you also need to provide additional 'type' information in this case for where clause to work.

So your filters array would look like :
Code: [Select]
                               'start_date' => array( 'title'        => 'Start Date',
                                                      'operatorType' => CRM_Report_Form::OP_DATE,
                                                      'type'         => CRM_Utils_Type::T_DATE
                                                      ),
Found this reply helpful? Contribute NOW and help us improve CiviCRM with the Make it Happen! initiative.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviReport (Moderator: Dave Greenberg) »
  • OP_DATE used to try to filter by date

This forum was archived on 2017-11-26.