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) »
  • Is DoB reportable?
Pages: [1]

Author Topic: Is DoB reportable?  (Read 1701 times)

EdP

  • I post frequently
  • ***
  • Posts: 260
  • Karma: 7
  • CiviCRM version: 4.4
  • CMS version: Joomla 2.5.x
Is DoB reportable?
April 15, 2013, 03:43:22 pm
One of my volunteers wants to create a report which lists the participant's / constituent's Date of Birth (or age). It doesn't appear to be listed as an available field in reports and since it's not a custom field I can't go and add it in.

Is DoB not reportable, or have I missed the setting to do it?

Thanks.
Ed

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: Is DoB reportable?
April 16, 2013, 01:32:12 am
Strange question perhaps, but what does your volunteer want to achieve with the DoB on a report? I have not checked the standard report yet but I use smart groups in combination with DoB to create for example a dynamic group of over 50's?
And you can use the Advanced Search option for DoB, does that help?
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Is DoB reportable?
April 16, 2013, 01:39:45 am
dynamic group of over 50's[/quote]

Almost forgot: happy birthday ;)
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

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: Is DoB reportable?
April 16, 2013, 01:42:51 am
Thank you, X....how thoughtful  ;)
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

EdP

  • I post frequently
  • ***
  • Posts: 260
  • Karma: 7
  • CiviCRM version: 4.4
  • CMS version: Joomla 2.5.x
Re: Is DoB reportable?
April 23, 2013, 06:58:34 am
Quote from: Erik Hommel on April 16, 2013, 01:32:12 am
Strange question perhaps, but what does your volunteer want to achieve with the DoB on a report? I have not checked the standard report yet but I use smart groups in combination with DoB to create for example a dynamic group of over 50's?
And you can use the Advanced Search option for DoB, does that help?

He runs our Learn to Row programme. He wants to do reports of e.g. (1) the ages of particpants in our learn to row events [a series of Events], or (2) to see a report of those waiting to learn to row (contacts tagged in a particular way).

I have said to him that he could, in theory, use Smart Groups to do some of this, but he finds CiviCRM pretty confusing already and telling him to go off in other screens and create other groups isn't helpful.

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: Is DoB reportable?
April 23, 2013, 10:56:59 am
Hmmm I see the issue :-) Unfortunately DoB does not appear on the standard report that you want. So I think you can either create the report for him out of Smart Groups, or customize the report so DoB does appear?
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

hbergin

  • I post occasionally
  • **
  • Posts: 66
  • Karma: 6
  • CiviCRM version: 3.4.5 to 4.4.1
  • CMS version: Drupal 6.28 to 7.23
  • MySQL version: 5.5.34
  • PHP version: 5.3.10
Re: Is DoB reportable?
May 15, 2013, 03:11:21 pm
Ed, is this still an issue for you?  Is the standard template your volunteer wishes to use for the report "Event Participant Report (List) - Template"?  I could look at providing an example of how to add the DOB field as an option, if that would help.

EdP

  • I post frequently
  • ***
  • Posts: 260
  • Karma: 7
  • CiviCRM version: 4.4
  • CMS version: Joomla 2.5.x
Re: Is DoB reportable?
May 24, 2013, 02:16:53 am
That would be useful, thanks.
Ed

hbergin

  • I post occasionally
  • **
  • Posts: 66
  • Karma: 6
  • CiviCRM version: 3.4.5 to 4.4.1
  • CMS version: Drupal 6.28 to 7.23
  • MySQL version: 5.5.34
  • PHP version: 5.3.10
Re: Is DoB reportable?
May 24, 2013, 10:45:39 am
This link gives very good detailed instructions on how to create your own report extensions if you can't find what you want in the standard report set:
http://wiki.civicrm.org/confluence/display/CRMDOC42/Create+a+Report-Template+Extension

In the targeted report template php file, add an entry for the birth date field to the civicrm_contact table's fields array in function __construct():

          'birth_date' =>
          array( 'title'     => ts( 'Birth date' ),
                 'name'      => 'birth_date',
          )
,

e.g.
Code: [Select]
    $this->_columns = array(
      'civicrm_contact' =>
      array(
        'dao' => 'CRM_Contact_DAO_Contact',
        'fields' =>
        array(
          'sort_name_linked' =>
          array('title' => ts('Participant Name'),
            'required' => TRUE,
            'no_repeat' => TRUE,
            'dbAlias' => 'contact_civireport.sort_name',
          ),
  'first_name' => array('title' => ts('First Name'),
          ),
  'last_name' => array('title' => ts('Last Name'),
          ),
          'id' =>
          array(
            'no_display' => TRUE,
            'required' => TRUE,
          ),
          'employer_id' =>
          array('title' => ts('Organization'),
          ),
          'birth_date' =>
          array( 'title'     => ts( 'Birth date' ),
                 'name'      => 'birth_date',
          ),
        ),
        'grouping' => 'contact-fields',

hbergin

  • I post occasionally
  • **
  • Posts: 66
  • Karma: 6
  • CiviCRM version: 3.4.5 to 4.4.1
  • CMS version: Drupal 6.28 to 7.23
  • MySQL version: 5.5.34
  • PHP version: 5.3.10
Re: Is DoB reportable?
May 24, 2013, 10:55:20 am
If you'd like to see the age, rather than the date, you can change this in the function alterDisplay in the same template php file:

Code: [Select]
    foreach ($rows as $rowNum => $row) {

      // age derived column
      if (array_key_exists('civicrm_contact_birth_date', $row)) {
        if ($value = $row['civicrm_contact_birth_date']) {
          $rows[$rowNum]['civicrm_contact_birth_date'] = floor((time() - strtotime($row['civicrm_contact_birth_date'])) / 31556926);
        }
        $entryFound = true;
      }

EdP

  • I post frequently
  • ***
  • Posts: 260
  • Karma: 7
  • CiviCRM version: 4.4
  • CMS version: Joomla 2.5.x
Re: Is DoB reportable?
July 30, 2013, 02:05:25 pm
(Belatedly) Thank you for this.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviReport (Moderator: Dave Greenberg) »
  • Is DoB reportable?

This forum was archived on 2017-11-26.