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 Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • can i create a smart group for people 65 and older?
Pages: [1]

Author Topic: can i create a smart group for people 65 and older?  (Read 1225 times)

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
can i create a smart group for people 65 and older?
February 26, 2009, 10:14:03 am
hey folks,

i have a group that needs to regularly look at a subsection of their members who are 65 and over. i thought a smart group would be useful, since age changes every day but cannot see how to accomplish it.

i tried to do a custom search but only have Birthdate available and there does not seem to be a way to get it to look up the age of the person based on a variable like *today*

any thoughts on how to do this?

thanks!

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: can i create a smart group for people 65 and older?
February 26, 2009, 10:53:58 am

you can build a custom search that takes in the age as a parameter (you can default this to 65)

You'll need to use sql date functions to grab all the contacts from the db who are older than 65

http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

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: can i create a smart group for people 65 and older?
February 26, 2009, 12:19:24 pm
thanks for the reply lobo. when you say "build a custom search" are you referring to the Search Builder? if so, how do i take in age as a parameter?

then you say "use sql date functions to grab all the contacts from the db who are older than 65." where would i do that? also in Search Builder?

trying to understand how this all fits together.

thanks!

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: can i create a smart group for people 65 and older?
February 26, 2009, 02:05:03 pm

check: http://wiki.civicrm.org/confluence/display/CRMDOC/Custom+Search+Components

you will need a fair amount of php/mysql expertise to build one. lots of examples are shipped in the distribution :)

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: can i create a smart group for people 65 and older?
March 02, 2009, 06:17:35 am
Hi,

For performance reason, I'd suggest to first calculate today's date, add 65 and use it as a constant in the sql. My experience with using date functions within sql is that it doesn't use indexes anymore most of the times.

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • can i create a smart group for people 65 and older?

This forum was archived on 2017-11-26.