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 Drupal Modules (Moderator: Donald Lobo) »
  • views + smartgroups
Pages: [1]

Author Topic: views + smartgroups  (Read 1592 times)

CatorgHans

  • I post frequently
  • ***
  • Posts: 157
  • Karma: 5
  • CiviCRM version: 4.4
  • CMS version: drupal
views + smartgroups
May 21, 2010, 12:32:53 am
Hi,

I was using a view where the groups are an exposed filter.
Some of the groups worked and others did not.

I noticed that the SQL the views module makes is searching in the civicrm_group_contact table, but that table does not contain "smart groups",does it? Does that mean that smart groups can not be queried via views?


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: views + smartgroups
May 21, 2010, 06:59:37 am

yes, you are correct. The "query" part of smart groups is not part of that table. Would be great if you can take a look and figure out how to add support for smart groups. You can potentially ensure that the smart group is cached:

Code: [Select]
if ( $group->cache_date == null ) {
  require_once 'CRM/Contact/BAO/GroupContactCache.php';
  CRM_Contact_BAO_GroupContactCache::load( $group );
}

and once its cached, link the view record to both civicrm_group_contact and civicrm_group_contact_cache

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

CatorgHans

  • I post frequently
  • ***
  • Posts: 157
  • Karma: 5
  • CiviCRM version: 4.4
  • CMS version: drupal
Re: views + smartgroups
May 21, 2010, 07:04:05 am
How can you be sure that the cached data is right, smart groups can change.
Or does civicrm handle that automatically and clears the cache when there is a risk that the smart group is changed?

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: views + smartgroups
May 21, 2010, 08:01:23 am

yes, we clear the cache whenever there is a risk that the smart group has changed.

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

Arvin

  • I’m new here
  • *
  • Posts: 8
  • Karma: 0
    • Freeform Solutions
Re: views + smartgroups
June 02, 2010, 06:32:01 am
I'm currently in the same situation. It would be ideal to have a smart group accessible via Views. So are you saying at this point it just doesn't work?

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: views + smartgroups
June 02, 2010, 06:53:41 am

at this point, smart groups does not work in views.

yes i do agree it would be ideal. would be great if you can work on it and get it working and/or sponsor a developer to do the needful

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) »
  • Support »
  • Using CiviCRM »
  • Using Drupal Modules (Moderator: Donald Lobo) »
  • views + smartgroups

This forum was archived on 2017-11-26.