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) »
  • cannot link my import table to the civicrm_contact table
Pages: [1]

Author Topic: cannot link my import table to the civicrm_contact table  (Read 1560 times)

nextwave

  • I post occasionally
  • **
  • Posts: 62
  • Karma: 0
cannot link my import table to the civicrm_contact table
September 09, 2009, 11:38:19 am
i imported a csv file which contain contacts information. some fields went into civicrm_contact table, while a new table was created that have all the fields in my csv file.

My cvs fields are:

First Name:
Last Name:
Phone:
Address:
CityIDNum:
BirthYear:
Sex:

After importing the file,
it added the first name and last name to civicrm_contact table and automatically generated a contact_id for each record.
It then created another database table called "importjob*******" where it stored all the fields and pulls the CityIDNum from.
it added the phone numbers to the civicrm_phone table using the unique contact_id.

Now, I want to update some contacts with phone numbers  but there is no way to link the importjob table to the civicrm_contact table.


my unique identifier in the importjob table is the citiIDnum which isnt in the contact nor phone table.
the unique identifier in the contact table is the contact_id which isnt in the importjob table.

I want to search for contacts using the CityIDNum since this was what I used to uniquely identify them in my csv file, but when i do search from the importjob table, I get the records quite all right, but I cant seem to have any way of relating these records to the actually civicrm_contact table since the unique id on the table is the contact_id.

any idea how the importjob table relates to the civicrm_contact table?

Kiran Jagtap

  • Ask me questions
  • ****
  • Posts: 533
  • Karma: 51
Re: cannot link my import table to the civicrm_contact table
September 10, 2009, 03:19:53 am
hi,

'civicrm_import_job_*' is the automatically created temporary table used by import process.
It is simply replica of data file ( .csv ) this table get automatically deleted once import process done.

Now mapping of this table fields to other civicrm data base table fields is done on user interface level ( Match Fields ) as one of the integrated step during import process.

Quote
Now, I want to update some contacts with phone numbers  but there is no way to link the importjob table to the civicrm_contact table.
please don't consider 'civicrm_import_job_*' table for your data manipulation.

to update contact on import I would like to follow these steps -
1. first thing find out ( decide ) unique key field for each contact record.
2. tweak contact matching  'Strict' rule to respect for unique field.
3. now import contact => use update mode
( now if civicrm found matching contact on the basis of contact matching field it will update matching contact w/ given record values. )

also Import document might help you.

hope this help

kiran
You Are Designed To Choose... Defined By Choice.

nextwave

  • I post occasionally
  • **
  • Posts: 62
  • Karma: 0
Re: cannot link my import table to the civicrm_contact table
September 10, 2009, 06:37:20 am
Thanks Kiran,
I think something went wrong with the import because I can still see the importjob table in my database. Has to do with birthyear field. The birthyear field isnt so important so I overlooked that. I got the important fields in the database and see no reason why I should delete and import over 105,000 records all over again.

I added some phone numbers to my csv files, and wanted to update those records in my database. However, since many names are similar, there is no way to check if Name "John" belongs to contact ID 1 or a similar name "John" belongs to the contact ID 1 since I used the "cityIDNum" to uniquely identify the names in my csv file.

I searched the whole of my database to see where else the "cityIDNum" is, aside from the importjob table, nothing came up. Which is why I was making a reference to my importjob table to get the unique cityIDNum, and then relate this to other civicrm tables, since I dont have the automatically generated "contact_ID" in my csv file.

Since "cityIDNum" is a custom field, is there a table this should actually be in ?
Cos when I search for contact using the front end application, I get the full information of the contact. So I thought civicrm was pulling the name from civicrm_contact table, the phone number from civicrm_phone table, and the cityIDNum from the importjob table.

Kiran Jagtap

  • Ask me questions
  • ****
  • Posts: 533
  • Karma: 51
Re: cannot link my import table to the civicrm_contact table
September 11, 2009, 05:14:30 am
hi,

Quote
I think something went wrong with the import because I can still see the importjob table in my database.
There are some edge cases in which import table remain in civicrm data base though import process is completed. you can manually delete these tables.

Quote
Since "cityIDNum" is a custom field, is there a table this should actually be in ?
table name might be like "civicrm_value_*"
( where * => 'custom data group name' _ 'custom data group id' )

I assume this field is unique for contact record. ( ie contact records can be differentiate on the basis of this custom field. )

now you need to tweak contact matching rule
go to : Administer CiviCRM -> Find and Merge Duplicate Contacts -> Edit Rule  ( Individual - Strict ) -> Select your custom field from 'Field' select and give proper 'Weight' w/  respect to "Weight Threshold to Consider Contacts 'Matching'".
( simply give weight equal to threshold )

now try to import contact w/ update mode and match this custom field. If import process found matching contact on the basis of given custom field value it will going to update matching record.

Just a extra bit of info - There is no need to have single field as a unique, you can combine various fields and make a group of fields and consider these fields group as unique to differentiate record, only thing is you need to tweak contact matching rule in that way.

you might want to take a look for contact matching rules.

hope this help

kiran
You Are Designed To Choose... Defined By Choice.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Import (Moderator: Yashodha Chaku) »
  • cannot link my import table to the civicrm_contact table

This forum was archived on 2017-11-26.