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 »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • How to control number of results returned by civicrm_api
Pages: [1]

Author Topic: How to control number of results returned by civicrm_api  (Read 461 times)

wingfingerbill

  • I’m new here
  • *
  • Posts: 18
  • Karma: 1
  • CiviCRM version: 4.4.14
  • CMS version: WordPress 4.1.1
  • MySQL version: 5.6.23
  • PHP version: 5.5.23
How to control number of results returned by civicrm_api
August 03, 2012, 02:40:52 am
Hi all

I'm wanting to get all contacts, so I'm using...

Code: [Select]
$contacts = civicrm_api('Contact','Get',array('version' =>3));
Works fine.  Except that I just get the first 25 entries.

Any clues as to how I get the whole lot?

Thanks

Bill

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: How to control number of results returned by civicrm_api
August 03, 2012, 02:56:13 am
Not sure if the new syntax works already

option.limit =>42 or options.limit=>42

or if it fails

rowCount=>42

do set a return="sort_name,email,whatever" and list only the fields you really want, the default is probably fetching more than you need
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

wingfingerbill

  • I’m new here
  • *
  • Posts: 18
  • Karma: 1
  • CiviCRM version: 4.4.14
  • CMS version: WordPress 4.1.1
  • MySQL version: 5.6.23
  • PHP version: 5.5.23
Re: How to control number of results returned by civicrm_api
August 03, 2012, 03:25:58 am

Quote
Not sure if the new syntax works already

option.limit =>42 or options.limit=>42

or if it fails

rowCount=>42

do set a return="sort_name,email,whatever" and list only the fields you really want, the default is probably fetching more than you need

Yes!

In fact,
Code: [Select]
rowCount=> -1 gives me the lot.  That's, 9,948 entries - so point taken about being a bit more specific. However, at this stage I'm still exploring. Such refinements will come later  ;)

Thank you

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • How to control number of results returned by civicrm_api

This forum was archived on 2017-11-26.