Hi there,
Not sure if this is a problem with Views or with Field Collection but I seem to have run into some sort of error.
I have a custom post type setup which has several fields all contained within a Field Collection. These fields are also grouped by the Field Group module.
When I create a view and add the field_collection field to that view I receive the error: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'field_data_field_collection.field_collection' in 'field list'
However, when I change the view to display the content instead of fields it works. The problem is that I need a bit more flexibility with the fields as I am planning on creating a colorbox which contains a form that is automatically populated with the field data.
Any idea why I am getting this error?
Comments
Comment #1
dawehnerI'm wondering why this field is actually added to the query. Do you have a view which has aggregation enabled?
In general always provide an export of the view, this provides a lot of help for some people to be able to understand what you really dif.
Comment #2
marcelleisp commentedHi dawehner,
Thank you for getting back to me. I do not have aggregation enabled on any of my views..
Here is an export of the view in question:
$view = new view;
$view->name = 'test_product_catalogue';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'Test Product Catalogue';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['title'] = 'Test Product Catalogue';
$handler->display->display_options['access']['type'] = 'perm';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['query']['options']['query_comment'] = FALSE;
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'none';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'fields';
$handler->display->display_options['row_options']['hide_empty'] = 0;
$handler->display->display_options['row_options']['default_field_elements'] = 1;
/* Field: Content: Title */
$handler->display->display_options['fields']['title']['id'] = 'title';
$handler->display->display_options['fields']['title']['table'] = 'node';
$handler->display->display_options['fields']['title']['field'] = 'title';
$handler->display->display_options['fields']['title']['label'] = '';
$handler->display->display_options['fields']['title']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['title']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['title']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['title']['alter']['word_boundary'] = 0;
$handler->display->display_options['fields']['title']['alter']['ellipsis'] = 0;
$handler->display->display_options['fields']['title']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['title']['alter']['trim'] = 0;
$handler->display->display_options['fields']['title']['alter']['html'] = 0;
$handler->display->display_options['fields']['title']['hide_empty'] = 0;
$handler->display->display_options['fields']['title']['empty_zero'] = 0;
$handler->display->display_options['fields']['title']['link_to_node'] = 1;
/* Field: Content: Field Collection */
$handler->display->display_options['fields']['field_collection']['id'] = 'field_collection';
$handler->display->display_options['fields']['field_collection']['table'] = 'field_data_field_collection';
$handler->display->display_options['fields']['field_collection']['field'] = 'field_collection';
$handler->display->display_options['fields']['field_collection']['label'] = '';
$handler->display->display_options['fields']['field_collection']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['field_collection']['alter']['text'] = '[field_collection]';
$handler->display->display_options['fields']['field_collection']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['field_collection']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['field_collection']['alter']['external'] = 0;
$handler->display->display_options['fields']['field_collection']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['field_collection']['alter']['trim_whitespace'] = 0;
$handler->display->display_options['fields']['field_collection']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['field_collection']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['field_collection']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['field_collection']['alter']['more_link'] = 0;
$handler->display->display_options['fields']['field_collection']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['field_collection']['alter']['trim'] = 0;
$handler->display->display_options['fields']['field_collection']['alter']['html'] = 0;
$handler->display->display_options['fields']['field_collection']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['field_collection']['element_default_classes'] = 1;
$handler->display->display_options['fields']['field_collection']['hide_empty'] = 0;
$handler->display->display_options['fields']['field_collection']['empty_zero'] = 0;
$handler->display->display_options['fields']['field_collection']['hide_alter_empty'] = 1;
/* Sort criterion: Content: Post date */
$handler->display->display_options['sorts']['created']['id'] = 'created';
$handler->display->display_options['sorts']['created']['table'] = 'node';
$handler->display->display_options['sorts']['created']['field'] = 'created';
$handler->display->display_options['sorts']['created']['order'] = 'DESC';
/* Filter criterion: Content: Published */
$handler->display->display_options['filters']['status']['id'] = 'status';
$handler->display->display_options['filters']['status']['table'] = 'node';
$handler->display->display_options['filters']['status']['field'] = 'status';
$handler->display->display_options['filters']['status']['value'] = 1;
$handler->display->display_options['filters']['status']['group'] = 1;
$handler->display->display_options['filters']['status']['expose']['operator'] = FALSE;
/* Filter criterion: Content: Type */
$handler->display->display_options['filters']['type']['id'] = 'type';
$handler->display->display_options['filters']['type']['table'] = 'node';
$handler->display->display_options['filters']['type']['field'] = 'type';
$handler->display->display_options['filters']['type']['value'] = array(
'products' => 'products',
);
/* Display: Page */
$handler = $view->new_display('page', 'Page', 'page');
$handler->display->display_options['path'] = 'test-product-catalogue';
Comment #3
marcelleisp commentedAnybody have an idea how this can be fixed?
Comment #4
Zenko commentedGetting the same error, someone help. Thank you.
Comment #5
esmerel commentedComment #6
kristen polI got a similar error with a view using Workflow fields due to an ordering issue in the left joins. I'm not sure of a fix yet in my case, but figured out the issue by looking at the SQL and running the query manually and then moving a left join so that it was defined before use in another left join and then it worked. Try looking at the SQL and pasting a copy here.