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 (Moderator: Dave Greenberg) »
  • Custom tables?
Pages: [1]

Author Topic: Custom tables?  (Read 1257 times)

klflote

  • I’m new here
  • *
  • Posts: 11
  • Karma: 0
Custom tables?
June 26, 2008, 08:02:26 pm
I have an existing database I've been working on importing into civicrm. The existing database is highly normalized -- for example, there is a table of instruments, a table of musicians, and a many-to-one relationship between them.

As far as I can tell, the only way to handle this is to create a custom field for the individual contact table call instruments_played and keep the instruments in a list. But before I go off and do this, I just wanted to see if there's some way to create custom tables that I've missed. (And then relationships between those tables.)




Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Custom tables?
June 27, 2008, 09:43:26 am
Creating a Custom Data group which is "Used for" Contact -> Individuals from Administer CiviCRM >> Custom Data seems like a fine way to handle this. You could potentially use a Multi-select HTML Type for the Instruments Played - although you'll have to experiment a bit with the import (not sure how well / if we handle import for multi-select fields).

Note that creating the custom data group and field(s) via the Admin screens will automagically create a new table in the database to store the field(s) - with a foreign key to the civicrm_contact records.
Protect your investment in CiviCRM by  becoming a Member!

klflote

  • I’m new here
  • *
  • Posts: 11
  • Karma: 0
Re: Custom tables?
June 28, 2008, 04:22:59 pm
Thanks Dave. Somehow I had missed the multi-select type when I was looking through the doc. I looked at how the database handles that; it uses multiple values in a single field (as I'd expected I'd have to do); how very cool that the civicrm web interfaces all know how to separate that out (both in display, and for input for data integrity purposes) so it looks like what an SQL system could do with an M-1 relationship between tables. [There are multiple tables involved here too, of course, but not in a typical joined manner.]

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM (Moderator: Dave Greenberg) »
  • Custom tables?

This forum was archived on 2017-11-26.