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 Import (Moderator: Yashodha Chaku) »
  • Import Parent/Child relationship
Pages: [1]

Author Topic: Import Parent/Child relationship  (Read 6064 times)

goodforkids

  • Guest
Import Parent/Child relationship
November 19, 2009, 05:04:36 pm
We have kids and their parents as constituents and I'd like to import all 3 as separate contacts.  I imported some kids then imported one parent mapping them as "Parent Of" in the matching field and their child appeared as a relationship in the parent record.  How do I make the parent appear as a relationship in the child record?

Thanks, Nicholas

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Import Parent/Child relationship
November 19, 2009, 08:13:31 pm

the relationship should appear in both the parent and the child records

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

goodforkids

  • Guest
Re: Import Parent/Child relationship
November 20, 2009, 11:29:42 am
Hi Donald.  I must be doing something wrong when I import the records.  I've tried using the 'Parent Of' field on the import module but the result is a separate record in addition to each parent record.  The separate record rather than the parent record is linked to the child record.  Is there documentation I can read on how to import relationships?

Thanks,
Nicholas

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Import Parent/Child relationship
November 20, 2009, 03:51:19 pm

1. ensure that you are using the update mode rather than the create mode

2. you might want to check the docs (http://wiki.civicrm.org/confluence/display/CRMDOC/Importing+Data) and/or the book for more information (http://en.flossmanuals.net/CiviCRM)

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

goodforkids

  • Guest
Re: Import Parent/Child relationship
November 21, 2009, 01:51:34 pm
Lobo, thanks for helping us with this issue.  Unfortunately I can't seem to find any documentation in either of the links that talks about how to import relationships and I've tried a number of different approaches using the import module. 

I understand the RDBMS principle that at the database level in a child's record there needs to be a primary key for each child and a foreign key for each of it's parents, and conversely in a parent's record there needs to be a primary key for the each parent and foreign key for each of it's children.  At the risk of pushing my luck with you generous support, could you please help me with the steps for importing these relationships through the import module?

Thanks,
Nicholas

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Import Parent/Child relationship
November 21, 2009, 03:37:56 pm
Not sure of your particular case but in general when importing and needing to create/import a relationship eg with an employer (being one i remember clearly) yu would import as individuals and have 'current employer' as a column. In the import mapping you would set your column with the Company name to be  (scroll way down in the list of "Matching CiviCRM Field") the item listed under 'related contact info' and make it 'employee of' (being the person you are importing) plus the field you have set up for your Company Name

So for parent child, you would have a csv with names for both persons. and if the column for the child was Child First Name and if you ae importing the 'parent' then when you get to matching up the column for the child's first name, set it to match to Related Contact Info > Parent of > Child First Name

and continue for Last Name etc

Hope that sorts it for you - and that i got the right end of the stick.
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

goodforkids

  • Guest
Re: Import Parent/Child relationship
November 22, 2009, 09:04:58 pm
I tried the steps you mentioned but for some reason the relationship between the children and parents didn't show in the Relationships tab.

I have 2 tables, one for children, one for mothers, and one for fathers.

1st I imported the childrens table including a column named Children_ID
2nd I imported the mothers table including a column named Mothers_ID.  When I mapped the table's columns to Civi fields I selected 'Parent_of' for the 'Mothers_ID' and mapped it to 'Children_ID'. 

Please help. What did I miss?

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Import Parent/Child relationship
November 22, 2009, 09:44:07 pm
In the steps above i tried to explain that when you import the table you can have the parent and child in the same row eg
Col A Parent First Name >> Last Name
Col 2 Parent Last Name >> First Name
Col 3 Child Last Name >> (related contact info) Parent of + First Name

if you have them in separate tables to import then if you have already imported
Col A Child First Name >> First Name
etc
Col C Child ID >> External ID

then when you import the parent table you will need to have the Child ID in a column as well and map that I think to
Child ID >>  (related contact info) Parent of + External ID

If you are trying to make the relationship during the import then you must have some info about both person's in your spreadsheet I think.
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

goodforkids

  • Guest
Re: Import Parent/Child relationship
November 23, 2009, 01:24:42 pm
That worked like a charm.  Thanks for your help Peter.

-Nicholas

erich_prinz

  • I’m new here
  • *
  • Posts: 25
  • Karma: 1
Re: Import Parent/Child relationship
December 10, 2009, 06:25:49 pm
Peter,

I've read through the post, played with it several different ways, and still don't get it (and unable to get this to work.) Perhaps a sample spreadsheet and a couple of screen shots would help if you don't mind indulging my need for visual anchors.

Thanks,

Erich

Quote from: peterd on November 22, 2009, 09:44:07 pm
In the steps above i tried to explain that when you import the table you can have the parent and child in the same row eg
Col A Parent First Name >> Last Name
Col 2 Parent Last Name >> First Name
Col 3 Child Last Name >> (related contact info) Parent of + First Name

if you have them in separate tables to import then if you have already imported
Col A Child First Name >> First Name
etc
Col C Child ID >> External ID

then when you import the parent table you will need to have the Child ID in a column as well and map that I think to
Child ID >>  (related contact info) Parent of + External ID

If you are trying to make the relationship during the import then you must have some info about both person's in your spreadsheet I think.


petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Import Parent/Child relationship
December 10, 2009, 06:57:35 pm
reasonable request - will add it to my wee list ;-)
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Import Parent/Child relationship
December 15, 2009, 01:39:31 pm
So if the table you were import had name of child and the Ext Id of the parent who had already been imported and cols were

Child First   Child Last   Parent External ID
Mary   Brown   987

then import would look as per images below
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Import Parent/Child relationship
December 15, 2009, 01:40:27 pm
hmm resolution not so good. Above image - you are scrolling right to bottom of the 'matching civicrm field' where you get to see all the ' - related contact info - ' and that is where you choose the relationship that the contact you are adding has to a contact already in the system. Then in the next option box that springs to life you select the field you are matching on eg 'organisation name' or 'external id' etc

hth
« Last Edit: December 15, 2009, 01:43:31 pm by peterd »
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

erich_prinz

  • I’m new here
  • *
  • Posts: 25
  • Karma: 1
Re: Import Parent/Child relationship
December 16, 2009, 09:01:02 am
The image is good enough for me to see where I went astray!

This is perfect - thank you Peter. You are greatly appreciated.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Import (Moderator: Yashodha Chaku) »
  • Import Parent/Child relationship

This forum was archived on 2017-11-26.