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) »
  • Should we get empty values ?
Pages: [1]

Author Topic: Should we get empty values ?  (Read 746 times)

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Should we get empty values ?
May 08, 2011, 01:36:37 am
Hi,

When using an api.get, the number of attributes might vary for each record, depending if this field is empty in the DB.

For instance, the first contact might have a 'email'=>'test@demo.org' but not 'phone', while the second will have a 'phone', no email, but a 'country'.

For my csv export, it means that the number of cell for each line is different, obviously not a good solution.

I am wondering if it wouldn't be better to have a mode that returns the same number of fields (and create empty fields if they are empty instead of skipping them, and have no clue of where to modify it.

What do you think, and any suggestion ?

X+

I have no idea
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Should we get empty values ?
May 08, 2011, 01:57:54 pm
My guess is this mainly applies to contact api? As it is the main api that gets 'stuff' from other entities? I suspect anything that works off one BAO does return the same fields empty or otherwise. In which case returning even if empty is the de facto standard
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

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Should we get empty values ?
May 08, 2011, 02:20:28 pm
For instance the relationshiptype seems to skip.

I will modify csv/export see if I can spot easily something

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: Should we get empty values ?
May 08, 2011, 11:15:49 pm
Empty ones rather than skipping would make more sense to me.
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Should we get empty values ?

This forum was archived on 2017-11-26.