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) »
  • Search with api using operators
Pages: [1]

Author Topic: Search with api using operators  (Read 458 times)

rubofvil

  • I’m new here
  • *
  • Posts: 23
  • Karma: 1
  • CiviCRM version: 4.2.7
  • CMS version: Drupal 7
  • MySQL version: mysql 5.1
  • PHP version: php 5.2
Search with api using operators
October 16, 2013, 07:54:04 am
Hi!

I'm trying to find contributions with the api, i'm using sql operator("<>") to search in a custom field, is it possible?

Thanks!

Code: [Select]
$params = array(
'version' => 3,
'payment_instrument_id' => 6,
'custom_53' => array('<>', '1'),

https://github.com/civicrm/civicrm-core/blob/master/api/v3/utils.php#L506

Version CiviCRM 4.3.7

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Search with api using operators
October 16, 2013, 12:48:42 pm
The Contribution.get api uses the BAO_Query object which doesn't follow a really consistent pattern - so that syntax works on 'some' fields (mostly ones I patched but not across the board. The api that call basic_get fn should follow that patter fairly consistently (however, they are less fully-featured).

So, in answer - if you fix that it would probably fix i for custom fields in the contact.get, contribution.get, pledge.get & some variants of membership.get.

In 4.4 the function you are looking at has been made available to the query objects (re-factored somewhat) so it would be easier to patch in 4.4.

We would certainly welcome a patch
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

rubofvil

  • I’m new here
  • *
  • Posts: 23
  • Karma: 1
  • CiviCRM version: 4.2.7
  • CMS version: Drupal 7
  • MySQL version: mysql 5.1
  • PHP version: php 5.2
Re: Search with api using operators
October 22, 2013, 05:18:22 am
Thank you for your clear explanation.

I'm wait to stable version 4.4 for reconsider the problem.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Search with api using operators

This forum was archived on 2017-11-26.