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 Drupal Modules (Moderator: Donald Lobo) »
  • Duplicate-free member directory possible???
Pages: [1]

Author Topic: Duplicate-free member directory possible???  (Read 6240 times)

crispinbailey

  • I post occasionally
  • **
  • Posts: 30
  • Karma: 1
  • CiviCRM version: 4.0.5
  • CMS version: Drupal 7
  • MySQL version: 5.1
  • PHP version: 5.3
Duplicate-free member directory possible???
August 04, 2011, 11:16:59 am
After combing through the online docs and this forum, I'm left wondering what's the best way to build my public Member Directory?

For context, I am running Drupal 7.7, CiviCRM 4.0.5, and Views 3.0-rc1

The problem I'm having is I can't get my views to not display contacts multiple times if they have multiple values for certain fields in their contact records (for example "Address: Country" or "Website URL"). If I try using Filters to specify which value to display (like "is Primary address" or "Website Type= Main"), I end up filtering out any and all contacts that do not have values in their records for those fields (since not all records have addresses or websites URLs). So that's no good. Seems to me that the problem is rooted in how CiviCRM handles certain fields to allow more than one value, but then again maybe it's actually a Views issue??? Either way it's quite frustrating.

I was about to give up on Views and start fresh using CiviCRM Profiles, but then I ran across several forum threads describing similar problems with duplicates showing up when more than one address/phone number/etc... exists for a contact record (see http://forum.civicrm.org/index.php/topic,11745.0.html for example)

I only want contacts to show up *once* - even if they have more than one address or website URL. Has anyone else had any luck dealing with this?

Thanks!

crispinbailey

  • I post occasionally
  • **
  • Posts: 30
  • Karma: 1
  • CiviCRM version: 4.0.5
  • CMS version: Drupal 7
  • MySQL version: 5.1
  • PHP version: 5.3
Re: Duplicate-free member directory possible???
August 04, 2011, 07:43:19 pm
So after more digging I have learned that this bug has been around for *years* without a fix. :o

There is an official issue that was created back in April 2010, but it looks like the bug has actually been around since August 2009 (http://forum.civicrm.org/index.php/topic,9501.0.html)

Anyway, according to the issue details (http://issues.civicrm.org/jira/browse/CRM-6082) this isn't going to get fixed until the 4.2 release and its priority is "minor". I'm a bit surprised that it's been assigned such a low priority considering it makes it impossible to create a decent directory unless you have really basic contact records (only 1 address, 1 phone number, 1 email address, 1 website, etc.). So maybe it isn't a show-stopper, but it's definitely a major issue if you're trying to create a professional-looking online directory.

Unfortunately I'm not a programmer so I can't just "jump in" and build a patch. Is there an official way to bump this up in priority or have it addressed sooner than the 4.2 release?

crispinbailey

  • I post occasionally
  • **
  • Posts: 30
  • Karma: 1
  • CiviCRM version: 4.0.5
  • CMS version: Drupal 7
  • MySQL version: 5.1
  • PHP version: 5.3
Re: Duplicate-free member directory possible???
August 07, 2011, 03:15:29 pm
Just following up after doing some more tinkering with Profiles... Some success! I was able to create a Member Directory listing all individuals and organizations (using Employee Of field) AND display a website URL, without displaying any duplicates. I'm not sure why it stopped showing duplicates, but it seems to be connected to the option of limiting the Profile results to a Group (in my case I created a parent group called "members" with the various categories of member groups as children). Anyway, it seems to work. No duplicates!  :)

Now if only I could mix Individual and Organization fields in the same Profile I'd be thrilled! Oh, and I would LOVE to be able to list Member Type in the same profile too, but either I have missed something or perhaps it's not possible...?? Last thing, it doesn't seem possible to display Groups either. I don't get that.

So I have given up on using Views to create a Member Directory for now. Until the integration of all fields works without throwing errors, and it's possible to display fields with multiple values without creating duplicate rows, the Profile option seems to be the way to go. While not perfect, at least it (sorta mostly) works for what my client needs.

Anyway, hope this info is of help to others.

CiviTeacher.com

  • I live on this forum
  • *****
  • Posts: 1282
  • Karma: 118
    • CiviTeacher
  • CiviCRM version: 3.4 - 4.5
  • CMS version: Drupal 6&7, Wordpress
  • MySQL version: 5.1 - 5.5
  • PHP version: 5.2 - 5.4
Re: Duplicate-free member directory possible???
August 07, 2011, 11:49:35 pm
Try limiting your addresses to "is primary", "work" or "home" with Views Filters.  this will show only one address per member, and it will show the primary address.  Otherwise you may get 3 results for 1 contact if that contact has 3 addresses.

« Last Edit: August 07, 2011, 11:51:39 pm by Stoob »
Try CiviTeacher: the online video tutorial CiviCRM learning library.

crispinbailey

  • I post occasionally
  • **
  • Posts: 30
  • Karma: 1
  • CiviCRM version: 4.0.5
  • CMS version: Drupal 7
  • MySQL version: 5.1
  • PHP version: 5.3
Re: Duplicate-free member directory possible???
August 08, 2011, 09:36:27 am
Thanks for the advice Stoob, I did try that. The caveat with that approach is that if you use a Views Filter to limit the results to a particular phone/address/url/etc it also filters out any contacts that don't have data supplied for that field. The logic of Filters seems to be "result must contain this value" rather than "result must only display this value".

This wouldn't be a problem if all contacts who are members had all fields filled in, but because some of them are not mandatory (as in the case of a website URL) it isn't a viable solution for me. Unfortunately the contacts in my case were all migrated from another system, and even Country was an optional field in the old system. Sigh...

I did read somewhere in these forums of a pretty smart workaround for handling multiple Website URLs which I should share here. Instead of using the default CiviCRM Website URL field, disable it (under Admin>Global Settings>Site Preferences) and then create custom fields for each type of URL you want your members to be able to share. So for example, you could create a custom field for "Company Website", and additional fields for "Personal Blog", "Twitter URL", "Facebook Page", etc... Then in your directory View you can choose to only display "Company Website" for example, and on the details page you can display the others. Ta-dah!

Of course, if (as in my case) you already have a database with 80,000+ contacts currently using the default Website field, there might be a bit of work to do before going with that solution. If only I had known what I know now *before* I did the original contact import!

MaffooClock

  • I’m new here
  • *
  • Posts: 4
  • Karma: 0
  • CiviCRM version: 4.2.2
  • CMS version: Drupal 7.18
  • MySQL version: 5.5.28
  • PHP version: 5.3.20
Re: Duplicate contacts in Drupal views
January 11, 2013, 09:56:48 am
I know this is over a year old, but it's still a valid problem.  I'm running v4.2.2, and the issue you referenced (CRM-6082) is currently set to "won't fix" status.  It was closed simply because it hadn't been worked on in 18 months and they wanted to clean up the issue queue.
« Last Edit: January 11, 2013, 11:00:55 am by MaffooClock »

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-free member directory possible???
January 11, 2013, 01:16:05 pm

maffooclock:

the number of open issues in the future list was getting a bit too large to deal with on a regular basis. Also a fair number of the older issues are not applicable due to various changes within the underlying code base / structure / architecture. So yes, we did make an arbitrary decision to close issues that were not modified or worked on for a long long time

that said, if you would like to revisit and work on that issue, we'd be happy to help you figure things out to contribute a patch towards this

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

zkrebs

  • I post occasionally
  • **
  • Posts: 69
  • Karma: 1
Re: Duplicate-free member directory possible???
April 08, 2013, 09:11:20 am
This might *really* help someone.

In CiviCRM 4.2.x onwards on Drupal 7 it seems like my CiviCRM fields in Views that are related to addresses have CiviCRM location settings, where I can choose to only show the primary city, state, zip, etc. as well as use filters to limit the selections. Maybe I missed this before, but it solved my problem.  8)

CiviTeacher.com

  • I live on this forum
  • *****
  • Posts: 1282
  • Karma: 118
    • CiviTeacher
  • CiviCRM version: 3.4 - 4.5
  • CMS version: Drupal 6&7, Wordpress
  • MySQL version: 5.1 - 5.5
  • PHP version: 5.2 - 5.4
Re: Duplicate-free member directory possible???
May 10, 2013, 11:28:13 am
Good point zkrebs, this issue is mostly resolved due to the addition of:

"Show CiviCRM Location Display Options" within the View Field (D7 + C 4.2) which allows you to add nuance to your views and avoid duplication.  For instance, you could choose to display

Address (Work)
Address (Other) ... in the same view, without duplication
Try CiviTeacher: the online video tutorial CiviCRM learning library.

Chasen

  • I’m new here
  • *
  • Posts: 22
  • Karma: 0
  • CiviCRM version: 4.4.x
  • CMS version: Drupal 7.x
  • MySQL version: 5.1.70
  • PHP version: 5.3.9
Re: Duplicate-free member directory possible???
July 09, 2013, 11:46:15 pm
Quote from: Stoob on May 10, 2013, 11:28:13 am
Good point zkrebs, this issue is mostly resolved due to the addition of:

"Show CiviCRM Location Display Options" within the View Field (D7 + C 4.2) which allows you to add nuance to your views and avoid duplication.  For instance, you could choose to display

Address (Work)
Address (Other) ... in the same view, without duplication

Hey guys,

Just a follow up to this, I'm having the exact same problem as the OP however, the location display options mentioned above seem to be available for all fields except the Website URL field - and this is the field giving me duplicates :(

In my view, I'm pulling drupal fields as well as various civicrm fields (including some from the 'contact' group and some from custom fields) - all are showing correctly except the users with multiple website URLs.

I was originally looking for a way to limit the URL field to just 1 entry, rather than * but couldn't seem to get that.

My CiviCRM phone number fields are showing up the CIVICRM LOCATION DISPLAY OPTIONS correctly - and work perfectly, but the Website URLs aren't.

My only guess here is this might be because the Website URL fields aren't sub-categorised. They're simply all "Website URL"; where as the different phone numbers are "Phone Number (Home)" or "Phone Number (Secondary)" with the bit in the brackets being the sup categorisation.

EDIT: on further inspection, it looks like they are sub categorised, but are all the same. So they're all "Website" primary category and "Home" sub-category. They mostly appear to be duplicates within a record - such as if the user has entered their website twice. Is there a way to find & merge fields within a contact field (rather than across contact fields)?
Ideally I could set the website field on the contact profile to just accept 1 value only (regardless of sub-category)

EDIT2: in the end, I enabled the distinct checkbox in the SQL advanced query settings which has resulted in the output that i wanted (not really a good solution, but an interim solution)
« Last Edit: July 10, 2013, 12:19:47 am by Chasen »

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Drupal Modules (Moderator: Donald Lobo) »
  • Duplicate-free member directory possible???

This forum was archived on 2017-11-26.