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 CiviContribute (Moderator: Donald Lobo) »
  • duplicate records on export, but not in search results
Pages: [1]

Author Topic: duplicate records on export, but not in search results  (Read 1365 times)

mtndan

  • Guest
duplicate records on export, but not in search results
July 14, 2009, 07:09:27 pm
Hi, we are observing a strange issue where doing a "Find Contributions" search returns 22 results. When I export all records, 24 records are exported, including two duplicates. Also, the export file (attached) seems to have mis-aligned columns, with long/lat info shifted into the city column on some records.

Any ideas? We're running 2.2.7 on Drupal 6

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: duplicate records on export, but not in search results
July 14, 2009, 08:28:31 pm

if you've got access to the mysql query logs can u see the difference between the two queries? also csn u check in the db to see if the 2 records have multiple primary address/email/phone?

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

mtndan

  • Guest
Re: duplicate records on export, but not in search results
July 19, 2009, 07:18:46 pm
It appears both duplicated records in the export have 2 address records marked as primary. How does that happen, and what's the best way to fix it. Thanks!

mtndan

  • Guest
Re: duplicate records on export, but not in search results
July 19, 2009, 07:37:49 pm
I do have query logs but can't seem to upload or attach them. Can I email them to you?

davej

  • Ask me questions
  • ****
  • Posts: 404
  • Karma: 21
Re: duplicate records on export, but not in search results
July 24, 2009, 03:38:20 am
We've also seen duplicates in exports where there are multiple primary addresses. I'd say the export should mirror the search results and only have one row per contact (for contact search) or per contribution (for contribution search). In contributions export, the duplicates cause an Excel sum on the amount column to give an incorrect total, which perturbs accounts staff!

Dave J

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: duplicate records on export, but not in search results
July 24, 2009, 11:51:30 am
Dave - Agreed. Hoping you can give us steps to replicate on demo - and post a bug report (with a patch if possible).
Protect your investment in CiviCRM by  becoming a Member!

davej

  • Ask me questions
  • ****
  • Posts: 404
  • Karma: 21
Re: duplicate records on export, but not in search results
July 27, 2009, 03:15:30 am
Perhaps there are two issue here:
  • How is a contact getting multiple primary addresses / email / phones?
  • When there are multiple primary addresses / emails / phones, how are the duplicate rows occurring in exports?

On the first issue, on one site we had this happen as a result of CRM-4737. A membership contribution on behalf of an Org was creating an address record flagged is_primary but with no location_type_id. This occurred because the location type was hard-coded as "Main" in CRM/Contribute/Form/Contribution/Confirm.php but this site had no location type "Main". A profile edit containing primary address fields then caused a second address record to be created, also flagged is_primary.

We had duplicates in exports on another site, also related to multiple locations, but haven't tracked this down yet.

On the second issue, presumably the duplicates occur because the export contains primary address/phone/email fields and the query has a join to civicrm_address etc, which will produce multiple rows if there are multiple address records.

So the question is whether it's always a bug to have multiple is_primary address/email/phone records - this comment by Lobo indicates that it is: Re: Exporting Participants Causing duplicate entries. I guess the same applies for multiple records of the same location type. If so then the task is to track down ways this can happen.

Dave J

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviContribute (Moderator: Donald Lobo) »
  • duplicate records on export, but not in search results

This forum was archived on 2017-11-26.