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) »
  • Drupal views with filter for group title - wrong SQL
Pages: [1]

Author Topic: Drupal views with filter for group title - wrong SQL  (Read 1588 times)

damaxl

  • I post occasionally
  • **
  • Posts: 46
  • Karma: 0
  • CiviCRM version: 4.1.2 DE
  • CMS version: Drupal 7.12 / 7.14
  • MySQL version: 14.12
  • PHP version: 5.2.6
Drupal views with filter for group title - wrong SQL
January 13, 2013, 08:33:41 pm
Hello,

in an installation with Drupal 7.18 + CiviCRM 4.1.2 we tried to build a view with contacts, whith a filter dropdown for groups.
We are able to design the view an the filter dropdown, but the produced SQL statement is incorrect, so the filter doesn't work

The filter criteria in the Drupal view is
CiviCRM Contacts: Contact Type (= Individual)
CiviCRM Groups: Titel (exposed)


The group with title 'Seniors' has id 11

The procuced SQL filter for this group
WHERE (( (civicrm_contact.contact_type IN  ('Individual')) AND (civicrm_group.title IN  ('11')) ))

As one can see, the problem lays in civicrm_group.title IN  ('11') which should be civicrm_group.title IN  ('Seniors')

Does somebody know about this problem and how to fix it?

Thanks in advance!

(sorry Pete, I pressed return too early and had not finished my text at that time)
 
« Last Edit: January 13, 2013, 08:54:49 pm by damaxl »

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
Re: Drupal views with filter for group title - weong SQL
January 13, 2013, 08:50:49 pm
you need to provide more details
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

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
Re: Drupal views with filter for group title - wrong SQL
March 03, 2013, 07:39:41 pm
should be sorted in the patch we just made

http://issues.civicrm.org/jira/browse/CRM-12009
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

commonpike

  • I’m new here
  • *
  • Posts: 12
  • Karma: 1
  • CiviCRM version: 4.4.6
  • CMS version: drupal 7.13
  • MySQL version: 5
  • PHP version: 5
Re: Drupal views with filter for group title - wrong SQL
September 28, 2014, 09:08:52 am
I'm using drupal 7.31 and civi 4.4.6, but the groups arent showing up in the views interface at all ? CiviCRM is there, with members, address, custom fields, relationships, events, but I see no tags and no groups.

I do see the relevant code in civicrm.core.inc. Is there something I need to enable ?

strange,
*-pike

commonpike

  • I’m new here
  • *
  • Posts: 12
  • Karma: 1
  • CiviCRM version: 4.4.6
  • CMS version: drupal 7.13
  • MySQL version: 5
  • PHP version: 5
Re: Drupal views with filter for group title - wrong SQL
September 28, 2014, 09:20:04 am
Actually, not completely. I was doing a view on drupal users, and filtering by civicrm properties. A lot shows up, but no groups and tags.
If I do a view on CiviCRM contacts, I do get options to filter on on group.

I also have option to set contextual filters based on group title; but if I do that, I get the same problem as the original op. The title is taken to be the id field. Entering '9' as a title works, entering 'asia' doesnt. The SQL reads

Code: [Select]
SELECT civicrm_contact.id AS id
FROM
{civicrm_contact} civicrm_contact
LEFT JOIN {civicrm_group_contact} civicrm_group_contact ON civicrm_contact.id = civicrm_group_contact.contact_id
LEFT JOIN {civicrm_group} civicrm_group ON civicrm_group_contact.group_id = civicrm_group.id
WHERE (( (civicrm_group.id = 'asia') ))
LIMIT 10 OFFSET 0

I guess I can work around it.

$2c,
*-pike
« Last Edit: September 28, 2014, 10:46:28 am by commonpike »

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Drupal Modules (Moderator: Donald Lobo) »
  • Drupal views with filter for group title - wrong SQL

This forum was archived on 2017-11-26.