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 CiviEvent (Moderator: Yashodha Chaku) »
  • Custom Data Fields in Reports - Again
Pages: [1]

Author Topic: Custom Data Fields in Reports - Again  (Read 1455 times)

lecxy

  • I’m new here
  • *
  • Posts: 3
  • Karma: 0
  • Sluggin through
  • CiviCRM version: 3.3.5
  • CMS version: Joomla 1.5.22
  • MySQL version: 5.0.91-community
  • PHP version: 5.2.9
Custom Data Fields in Reports - Again
March 31, 2011, 07:35:03 pm
I'm really new to civiCRM and I know this has come up time and time again, and I've found numerous posts on the topic. but I'm having a problem.

I've created an event registration page based on a profile I've called Team Member.  It contains custom data sets that contain the name of the team and a Yes/No radio buttons to indicated Team Leader.  This works fine in the Registration page.

Now, I would like these fields to appear in the Participants List Report.  There must be an easy way to get custom data to be included in standard reports.  I've found this string recommended several times:

  protected $_customGroupExtends = array( 'Contact' );    - or a variation of it.

It seems to refer to either criteria.php or participantlist.php. 

For the life of me, I can't find these .php files.  Everything has a .tpl extension 

I have some exposure to coding, but haven't done it in ages...

Can anyone point me in the right direction, please.
Putting it together one piece at a time

xcf33

  • I post frequently
  • ***
  • Posts: 181
  • Karma: 7
  • CiviCRM version: 3.3.2
  • CMS version: Drupal 6.19/6.20
  • MySQL version: 5.x
  • PHP version: 5.2.6
Re: Custom Data Fields in Reports - Again
March 31, 2011, 08:44:15 pm
If you are looking at changing a report,

I suggest you look under

/CRM/Report/Form/Event/ParticipantListing.php

For Event participant listing.

As for

protected $_customGroupExtends = array( 'Contact' );

That only means that the "Contact" entity custom fields will be exposed in the report as filters (so you can filter your report by contact custom fields, say you have a custom field for contact named "Pet name"), It doesn't help you with display the custom field on the report.


In your use case although I'm not familiar with events but I have done custom reports with custom field as columns, it just involve a couple of look ups in civicrm for the report SQL joins.


1. Looking at the custom field, find the field ID of the custom field (just the ID column)
2. You can use a utility function CRM_Core_BAO_CustomField::getTableColumnGroup($id);
to get the table that stores the custom field value as well as the column name for that custom field
3. Use that information to build (or append to your current report SQL)


It might look like a daunting task and if I'm speaking alien to you have a look at how to build a custom CiviCRM report first.



Hope it makes some sense,


Cheers!

josue

  • I post occasionally
  • **
  • Posts: 81
  • Karma: 7
    • PTP
  • CiviCRM version: 3.4.4, 4.1.1
  • CMS version: Drupal 6.24, Drupal 7.12
  • MySQL version: 5.0
  • PHP version: 5.2
Re: Custom Data Fields in Reports - Again
April 01, 2011, 07:48:14 am
Quote from: lecxy on March 31, 2011, 07:35:03 pm
I've found this string recommended several times:

  protected $_customGroupExtends = array( 'Contact' );    - or a variation of it.

It seems to refer to either criteria.php or participantlist.php. 

For the life of me, I can't find these .php files.  Everything has a .tpl extension 

hi lecxy,

the civicrm manual is quite helpful. that is a good place to get a better understanding of how all this works.

the structure of the civi code has tpl and php files. this separates the look (templates) from the code that grabs the data (php). people like Xavier like to blur that distinction by creating cool ajax features that allow you to grab data from templates but ths is free software, so people can do what they like and if it is useful it can be included in future versions.

for your specific question, that report ParticipantListing.php lives where changx said: your civicrm module folder/CRM/Report/Form/Event.

in that file, if you change line 47:

protected $_customGroupExtends = array( 'Participant' );

to

protected $_customGroupExtends = array( 'Contact', 'Individual', 'Participant' );

when you save it and reload the report you will have access to the custom fields you created that are a part of the Individual record. custom fields for the Participant record should already be available in the report.

hth,

--josue

lecxy

  • I’m new here
  • *
  • Posts: 3
  • Karma: 0
  • Sluggin through
  • CiviCRM version: 3.3.5
  • CMS version: Joomla 1.5.22
  • MySQL version: 5.0.91-community
  • PHP version: 5.2.9
Re: Custom Data Fields in Reports - Again
April 02, 2011, 11:17:59 am
Thanks to both of you. 

Changx I appreciate what you are saying.  I have looked at creating a custom report, but I really thought that was too much since all I really want to do is call up additional information on an existing report.  It is something I will no doubt get into more in depth.

josue, I understand completely.  And I finally found the php file not just the template file....it helps if you get some sleep!

Now, the problem is that line 47 does not exist as described in your post. and I think I'm going to be relegated to using the utility changx recommended.

I've attached a copy of ParticipantListing.php to see if you agree, that is if either of you could take the time to have a look.

Grateful for you collective patience,

lecxy


Putting it together one piece at a time

josue

  • I post occasionally
  • **
  • Posts: 81
  • Karma: 7
    • PTP
  • CiviCRM version: 3.4.4, 4.1.1
  • CMS version: Drupal 6.24, Drupal 7.12
  • MySQL version: 5.0
  • PHP version: 5.2
Re: Custom Data Fields in Reports - Again
April 02, 2011, 04:19:14 pm
hey lecxy,

it looks like the file you attached here is CRM/Event/Form/ParticipantView.php not CRM/Report/Form/Event/ParticipantListing.php

try to edit ParticipantListing.php and let us know...

--josue

lecxy

  • I’m new here
  • *
  • Posts: 3
  • Karma: 0
  • Sluggin through
  • CiviCRM version: 3.3.5
  • CMS version: Joomla 1.5.22
  • MySQL version: 5.0.91-community
  • PHP version: 5.2.9
Re: Custom Data Fields in Reports - Again
April 06, 2011, 07:19:15 am
I'm sorry josue.....I'm usually not this dense...and usually more available.
I made the changes...to the CORRECT file, etc, and didn't see any difference.
I'm going to let the matter go for the moment.  I think perhaps it will be better addressed when I have a better grasp on the program.
Thank you so much for your help and patience in the meantime.
Anita
Putting it together one piece at a time

tamarackmedia

  • I’m new here
  • *
  • Posts: 8
  • Karma: 0
  • CiviCRM version: Various
  • CMS version: Various
  • MySQL version: Various
  • PHP version: Various
Re: Custom Data Fields in Reports - Again
January 05, 2012, 09:42:31 am
Josue's solution did exactly what I was looking for.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • Custom Data Fields in Reports - Again

This forum was archived on 2017-11-26.