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) »
  • Trying to add a Group By field to activity.php
Pages: [1]

Author Topic: Trying to add a Group By field to activity.php  (Read 1024 times)

sraisz

  • I post occasionally
  • **
  • Posts: 52
  • Karma: 0
    • sambandha.net
  • CiviCRM version: 3.3.5
  • CMS version: Drupal 6
Trying to add a Group By field to activity.php
April 07, 2010, 01:01:41 pm
Hi,

I am trying to make a custom report which is a slight modification of the activity report adding an additional "group by" field

I modified the part of activity.php which has the "Group_by" as follows:

array( 'source_contact_id'  =>
                                              array('title'    => ts( 'Source Contact' ),
                                                    'default'  => true ),
                                              'activity_date_time' =>
                                              array( 'title'   => ts( 'Activity Date' ) ),
                                              'activity_type_id'   =>
                                              array( 'title'   => ts( 'Activity Type' ) ),
                                              'contact_target'   =>
                                              array( 'title'   => ts( 'Target Contact' ) ),
                                              ),
                                       'grouping' => 'activity-fields',
                                       'alias'    => 'activity'


But I get this error when I try to run the report:


DB Error: no such field

Database Error Code: Unknown column 'activity_civireport.contact_target' in 'group statement', 1054


I'm not a programmer, so I could use some help here.

Any suggestions?

demeritcowboy

  • Ask me questions
  • ****
  • Posts: 570
  • Karma: 42
  • CiviCRM version: Always the latest!
  • CMS version: Drupal 6 mostly, still evaluating 7.
  • MySQL version: Mix of 5.0 / 5.1 / 5.5
  • PHP version: 5.3, usually on Windows
Re: Trying to add a Group By field to activity.php
April 07, 2010, 07:34:09 pm
The target contact is not stored in the activity table. You'll need to add the civicrm_activity_target table into that mix if it's not already there.

There's a "with contact" custom search in the physician health repository you might find useful.
http://svn.civicrm.org/php/trunk/custom_php/CRM/Contact/Form/Search/Custom/WithContactSearch.php
http://svn.civicrm.org/php/trunk/custom_templates/CRM/Contact/Form/Search/Custom/WithContactSearch.tpl

sraisz

  • I post occasionally
  • **
  • Posts: 52
  • Karma: 0
    • sambandha.net
  • CiviCRM version: 3.3.5
  • CMS version: Drupal 6
Re: Trying to add a Group By field to activity.php
April 15, 2010, 12:23:51 pm
thank you for your suggestions.

As far as I can see the table is already there. All I tried doing is modifying the existing Activity.php report  which includes the target contact field in the results.

this report currently groups the results by the Source Contact. So you can get

Source Contact1 Target contact 1              Activity
Source Contact1 Target contact 2              Activity
Source Contact1 Target contact 1              Activity
Source Contact1 Target contact 2              Activity

what I'm trying to do is group all the activities related to a specific target contact within the source contact like this:

Source Contact1 Target contact 1              Activity
Source Contact1 Target contact 1              Activity
Source Contact1 Target contact 2              Activity
Source Contact1 Target contact 2              Activity


Any suggestions would be appreciated.

I attach the php file (as a text file) I am trying to use.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviReport (Moderator: Dave Greenberg) »
  • Trying to add a Group By field to activity.php

This forum was archived on 2017-11-26.