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) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Age range for individuals in query and smart group criteria
Pages: [1]

Author Topic: Age range for individuals in query and smart group criteria  (Read 722 times)

ePeterso2

  • I’m new here
  • *
  • Posts: 4
  • Karma: 0
  • CiviCRM version: 4.3.3
  • CMS version: Drupal 7.30
  • MySQL version: 5
  • PHP version: 5.3
Age range for individuals in query and smart group criteria
July 16, 2012, 04:22:22 am
I am using CiviCRM to (amongst many things) manage students in a nonprofit performing arts education program. We are just about to start an alumnae association for girls who have graduated from our program.

To be eligible to be in the alumnae association, an individual contact must meet two criteria:

1. The contact must have held an active membership in our program at any time in the past.
2. The contact must be at least 17 years of age.

I have been trying to create a query and smart group to automatically select girls who meet these criteria as of the date on which the query is run. I know the Advanced Search today allows me to satisfy condition 1 above, but I don't know how to satisfy condition 2.

I've poked around inside CRM/Contact/Form/Search/Criteria.php, and I can see where the age range of birth dates is queried. But I don't know how to go about implementing this addition.

I'm up for coding this myself, but I just don't have the familiarity with the architecture to know where to begin.

Any pointers would be greatly appreciated ...

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: Age range for individuals in query and smart group criteria
July 16, 2012, 09:53:34 am

Check:

CRM/Contact/BAO/Query.php

thats where all the query logic is. You can probably add an "age" field in Criteria.php

and write code that checks against this age in the Query.php

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

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Age range for individuals in query and smart group criteria

This forum was archived on 2017-11-26.