3

I'm using Views to display lists of CiviCRM contacts (4.5.2). I'm finding that several contacts appear in Views twice. Any ideas what might be going on here?

  • What are the views filters? Are you using relationships or contextual filters? Which ones? – Nicholai May 20 '15 at 12:23
  • I'm filtering on contact type (Organisation) and whether or not the contact is deleted. – Tim Vaughan May 21 '15 at 13:12
5

The culprit is often the website field which has no filters that enable you to specify which of a number should show and hence they produce multiple rows. But like others say, it could be Address, Email or Phone if you haven't specified either the location type or Primary only. Or multiple relationships etc.

  • I removed the website field and it appears you're right, that was what was causing the problem. Can I fix that without removing the other websites, do you know? – Tim Vaughan May 21 '15 at 13:16
  • There needs to be some addition to the Views-Civi code so that the web field can have settings as per the Address/Phone fields so it can be limited to a particular 'website type' – petednz - fuzion May 21 '15 at 21:53
  • 1
    You should be able to use CiviCRM Entity and it will provide an explicit relationship between Contact and Website entities. Then you can provide a Website entity type or type_id or is_primary filter that uses that relationship, to limit it – jackrabbithanna May 22 '18 at 20:14
4

Why this is happening depends very much on how your View is set up, providing an export of the View might help us investigate.

One thing that might help is turning on the 'Distinct' option in the View, to force only one of each result appearing.

This can be done whilst editing the View, under: Advanced > Other > Query settings > Tick 'Distinct'

  • Thanks - I've tried the "Distinct" option and the results are the same. I think it may be because I'm using the website field. – Tim Vaughan May 21 '15 at 13:13
  • Here's an export of the view: pastebin.com/5efTMf4U – Tim Vaughan May 21 '15 at 13:15
3

If you use adress fields and the contact has several addresses in CiviCRM the contact will be shown several times. In that case you could configure the address fields to only show the primary record.

enter image description hereenter image description here

  • that is "add a filter" to select just the type of address you want to display – Eliot Mason May 21 '15 at 5:36
  • I actually meant not a filter - it is a setting if you click on the CiviCRM field in the views - see screenshots. – Fabian May 21 '15 at 8:53
1

There is a work-around for this. Take the example of multiple phone numbers in a contact record.

  1. Include the Phone Number field once for each unique type of number (Home/Mobile, Home/Phone, Work/Phone etc)

Screenshop

  1. In Civicrm Location Display Options for each field, select unique combinations (e.g. Location Type = Work & Phone Type = Phone). Do NOT select "Show only Primary record"

enter image description here

  1. Mark each of these fields as "Exclude from Display", and add a Rewrite Results for each one followed by a comma (e.g. Rewrite as "[phone],"

  2. Add a "dummy" field AFTER the Phone Number fields, using any unused CiviCRM field (e.g. PostCode Suffix) and in this change the Label to e.g. "Phone Number(s)" and the Rewrite Results to "[phone] [phone_1] [phone_2]" (or whatever the PN fields are called).

The result should be one line in the output per contact, and the multiple phone numbers will be concatenated in the Phone Number(s) column.

Hope this works for you. Tom C

1

Unfortunately, I believe in my case because I was using Household relationships and Addresses of Employers this caused a lot of duplicates.

What did work for me was to set Aggregation on. Then setting Group by on your main element that you wish to not duplicate. Viola all is well!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.