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) »
  • Creating field for Age and run cron
Pages: [1]

Author Topic: Creating field for Age and run cron  (Read 697 times)

matthewboh

  • I post occasionally
  • **
  • Posts: 89
  • Karma: 2
Creating field for Age and run cron
October 16, 2012, 12:53:18 pm
I would like to be able to list off the age of our volunteers, so we've been gathering the birth dates for them. However, to include age on a report seems a little tricky.

Is it possible to create a custom field called "Age", then have a cron job that runs at midnight to update the age field?

Would it be best to create a user that has very limited access to the data so that it can only update the age field and read the birth date field?

Are there other gotcha's that I'm missing?

Thanks in advance!

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Creating field for Age and run cron
October 17, 2012, 10:30:14 am
You can compute age in a report, either via PHP or MySQL, but if you prefer to have it as a field, you can make a read-only field and then what I would do is a one-time script to populate all Contacts and then a hook to re-compute a Contact when he is edited.

I in fact did just that for a Drupal 6 site once. :)
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviReport (Moderator: Dave Greenberg) »
  • Creating field for Age and run cron

This forum was archived on 2017-11-26.