I created a view (on the bottom of this page). When I tell the CCK field to use this view for autocompletion I get the following error:

The Error:
user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') = UPPER('')) ) AS count_alias' at line 9 query: SELECT COUNT(*) FROM (SELECT users.uid AS uid, profile_values_profile_nachname.value AS profile_values_profile_nachname_value, profile_values_profile_voraname.value AS profile_values_profile_voraname_value, title, nid FROM users users LEFT JOIN profile_values profile_values_profile_nachname ON users.uid = profile_values_profile_nachname.uid AND profile_values_profile_nachname.fid = '2' LEFT JOIN profile_values profile_values_profile_voraname ON users.uid = profile_values_profile_voraname.uid AND profile_values_profile_voraname.fid = '1' WHERE (UPPER(profile_values_profile_nachname.value) != UPPER('')) AND (UPPER(profile_values_profile_voraname.value) != UPPER('')) AND (UPPER(.title) = UPPER('')) ) AS count_alias in C:\xampp\htdocs\hplb\sites\all\modules\views\includes\view.inc on line 652.

Would be way awesome if you had a solution for me. This module really rocks!

Here is my view:

$view = new view;
$view->name = 'users';
$view->description = 'List all users -> to be used as autocompletion for node reference';
$view->tag = 'intern';
$view->view_php = '';
$view->base_table = 'users';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Standards', 'default');
$handler->override_option('fields', array(
  'value' => array(
    'label' => 'Nachname',
    'exclude' => 0,
    'id' => 'value',
    'table' => 'profile_values_profile_nachname',
    'field' => 'value',
    'relationship' => 'none',
  ),
  'value_1' => array(
    'label' => 'Vorname',
    'exclude' => 0,
    'id' => 'value_1',
    'table' => 'profile_values_profile_voraname',
    'field' => 'value',
    'relationship' => 'none',
  ),
));
$handler->override_option('filters', array(
  'value' => array(
    'operator' => '!=',
    'value' => '',
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'case' => 1,
    'id' => 'value',
    'table' => 'profile_values_profile_nachname',
    'field' => 'value',
    'relationship' => 'none',
  ),
  'value_1' => array(
    'operator' => '!=',
    'value' => '',
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'case' => 1,
    'id' => 'value_1',
    'table' => 'profile_values_profile_voraname',
    'field' => 'value',
    'relationship' => 'none',
  ),
));
$handler->override_option('access', array(
  'type' => 'none',
  'role' => array(),
  'perm' => '',
));
$handler->override_option('items_per_page', 0);
$handler->override_option('style_plugin', 'list');
$handler->override_option('row_options', array(
  'inline' => array(),
  'separator' => '',
));

Comments

yched’s picture

Status: Active » Postponed (maintainer needs more info)

I cannot reproduce this. Please make sure you are using the latest 6.x-2.x-dev Views and CCK releases (or CCK rc7, which we just rolled)

rapsli’s picture

Category: bug » support
Status: Postponed (maintainer needs more info) » Active

Probably I'm using it the wrong way then. I upgraded to the suggested versions. What I want to do is the following:

I got a view that lists name and surename of a user (with the profile module). No I want to reference this view. It though doesn't show up anymore. I can't select that view. Maybe there's just still something with the cache...? Or is it not possible to reference to users?

yched’s picture

CCK RC7 lets you specify a view to define the pool of users that can be referenced in a userreference field. Aside from that, I'm not sure what you mean.

It though doesn't show up anymore. I can't select that view
That's different from the behavior you reported initially :-) Please make a clear description of where you are with this right now : what you want to get, what you do in order to get it, what you expect, what you get instead.

rapsli’s picture

Status: Active » Fixed

seems to work fine. sorry, i still had the old userreference module in mind.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.