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) »
  • Importing corrected Postcode data to Primary Location
Pages: [1]

Author Topic: Importing corrected Postcode data to Primary Location  (Read 1680 times)

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
Importing corrected Postcode data to Primary Location
October 29, 2008, 01:35:43 pm
Hi - we just did a massive mailout, and the mailhouse has corrected lots of our addresses so I now want to reimport the corrected Post codes.

But of course the address I used were 'Primary' which would include 'home' 'work' 'main' maybe even 'billing'

Any way you can suggest I can do the import (via Import Wizard or in mySQL) so that the postcode updates the address that is identified as the 'primary' address.

Is this something that should be available via the Import Wizard?
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

Chris Burgess

  • Ask me questions
  • ****
  • Posts: 675
  • Karma: 59
Re: Importing corrected Postcode data to Primary Location
October 29, 2008, 01:47:42 pm
I don't know if CiviCRM import lets you match on address criteria (rather than contact criteria). If that was possible, perhaps you could do that.

However, you can do something similar in SQL. For example, load a CSV like this into a temp table:
Code: [Select]
Number,Street,Addr2,Addr2,Postcode
23,Winton Rd,Dingleton,Wellington,3093
12,Queen St,Ak Central,Auckland,1000

Then do an SQL update like this (example below simplified, but you get the idea)
Code: [Select]
UPDATE civicrm_address a, temp.imported_csv c
   SET a.postal_code = c.postcode
 WHERE a.street_number = c.number
   AND a.street_name = c.street
   AND a.supplemental_address_1 = c.addr2
   AND a.supplemental_address_2 = c.addr3 ;

That will match the addresses using SQL and copy the updated postcodes from the CSV to your civicrm_address table.

This is example code only!

Code which did something like this in CiviCRM (a contact-agnostic method for address cleanups) would be a useful feature for us.

I wonder if there's much demand from other users for such a thing?
« Last Edit: October 29, 2008, 01:52:26 pm by xurizaemon »
@xurizaemon ● www.fuzion.co.nz

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Import (Moderator: Yashodha Chaku) »
  • Importing corrected Postcode data to Primary Location

This forum was archived on 2017-11-26.