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 Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Accessing custom text field data
Pages: [1]

Author Topic: Accessing custom text field data  (Read 1677 times)

Wonder95

  • Guest
Accessing custom text field data
March 20, 2008, 01:16:57 pm
I created a custom data field that is used in a profile that is part of a contribution (used for membership registration) page.  I need to get the data from this custom field via query so I can display it in a block on the front page of the site.  Where is the actual data that has been entered in this field stored?  The closest I can tell is in the char_data field in the civicrm_custom_value table.  Is this correct?  If so, how do I translate the field values to text so I can display them?

Thanks.

emilyf

  • Ask me questions
  • ****
  • Posts: 696
  • Karma: 54
  • CiviCRM version: 2.x - 4.x
  • CMS version: Drupal 5, 6, 7
Re: Accessing custom text field data
March 20, 2008, 02:11:56 pm
You can reference the ERD for 2.0 and look in the custom tables section for a full explanation: http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+ERD+2.0.

But basically, the way it works is that each set of custom fields actually gets its own table created (in 2.0 mind you). So your table will be prefixed with

civicrm_value_

then the custom group id (which is created in the civicrm_custom_group table -- each group of custom fields gets a group id)
then another _ and the name of your custom group. So if I have a custom group called 'Constituent Information' and it's group id happens to be 1, then the table that holds my data will be called

civicrm_value_1_constituent_information

That's probably the only real table you care about, but just FYI that the other main tables used to hold the custom data structure are civicrm_custom_group as mentioned and civicrm_custom_field which holds the fields that builds your custom group.

Hope that helps.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Accessing custom text field data

This forum was archived on 2017-11-26.