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 »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Smart Group - GetCount
Pages: [1]

Author Topic: Smart Group - GetCount  (Read 353 times)

elcongrio

  • I’m new here
  • *
  • Posts: 26
  • Karma: 0
  • CiviCRM version: 3.6.1
  • CMS version: Wordpress
  • MySQL version: 5.3
  • PHP version: 5.3.3
Smart Group - GetCount
September 04, 2014, 04:26:39 pm
Hi everyone:

I'm trying to get the contact's count of a smart group by API. When I run the query against the Contact's API, I'm doing the following query:

civicrm_api("Contact","GetCount",array( 
    'version' => 3,
    'group' => my_smart_group_id
));

But this query returns 1.
Any ideas?

Thanks in advance!

Michael McAndrew

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1274
  • Karma: 55
    • Third Sector Design
  • CiviCRM version: various
  • CMS version: Nearly always Drupal
  • MySQL version: 5.5
  • PHP version: 5.3
Re: Smart Group - GetCount
September 05, 2014, 02:03:04 am
I got the same on 4.4.6.

get returns 0 for a smart group for me and getcount returns 1.

my hunch is that the api does not work with smart groups (since they are saved queries and don't pull info from the same table FWIW, you might be interested to know that smart group contacts are stored in civicrm_group_contact_cache).

Sounds like a bug / not yet implemented feature though others might correct me. See http://forum.civicrm.org/index.php?topic=22924.0 as well for another approach.

Service providers: Grow your business, build your reputation and support CiviCRM. Become a partner today

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Smart Group - GetCount

This forum was archived on 2017-11-26.