Closed (fixed)
Project:
Views (for Drupal 7)
Version:
7.x-3.x-dev
Component:
fieldapi data
Priority:
Minor
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
28 Jun 2011 at 19:37 UTC
Updated:
18 Dec 2011 at 07:53 UTC
I've got a content type that has a state selection dropdown field, and I'd like to get a list of all selected values.
When I turn on aggregation on that field, I get no results and dozens of errors like these:
Notice: Trying to get property of non-object in entity_extract_ids() (line 7368 of /home/domains/alaa/www/includes/common.inc).
Notice: Undefined index: field_name in field_language() (line 275 of /home/domains/alaa/www/modules/field/field.multilingual.inc).
Notice: Undefined index: in _field_invoke_multiple() (line 299 of /home/domains/alaa/www/modules/field/field.attach.inc).This is the query that it's trying to run:
SELECT field_data_field_state.field_state_value AS field_data_field_state_field_state_value, MIN(node.nid) AS nid, 'node' AS field_data_field_state_node_entity_type
FROM
{node} node
LEFT JOIN {field_data_field_state} field_data_field_state ON node.nid = field_data_field_state.entity_id AND (field_data_field_state.entity_type = node AND field_data_field_state.deleted = 0)
WHERE (( (node.status = '1') AND (node.type IN ('allergist')) ))
GROUP BY field_data_field_state_field_state_value
ORDER BY field_data_field_state_field_state_value ASCI'm not sure if this is just something that Views is showing funny, but if I run that query directly, I get the correct results, but only if I add quotes around 'node' in the join on field_data_field_state.entity_type = node.
Comments
Comment #1
mradcliffeI got these warnings under the following scenario as well:
Non-content view (custom entity) with content relationship
Aggregate true
Node field with aggregate group column set to "value" and not "entity id".
In my case, I was not actually using the that field's value, so I switched it to entity id and the warnings were no longer triggered. I also tried adding a field from a custom entity, and that did not trigger the error when aggregation group column was set to "value".
Hope this helps track it down.
Comment #2
karlsheaI am not using a custom entity, just a normal content type.
The aggregate group column is set to "value" however, and I do need to use the value. When I set it to "entity id" it no longer throws the error, but I don't get the results that I need.
At least I have a confirmation though :-)
Comment #3
mradcliffeStill valid for Drupal 7.4.
Comment #4
mradcliffeA body text field generates the following warnings when aggregate settings set to value for that field.
I tried a date field on another site with date 7.x-2.x-dev, and I did not witness any warnings.
I'm trying to come up with a test view that demonstrates everything without being too customized.
Comment #5
mradcliffeThe initial issue was fixed in #1194900: Missing values with aggregation sum, avg, min, max (patch included) on June 28th, commit f9af377bfcdd19d3a047d76d956a1871e1c0aed3.
The _text_sanitize issue was introduced in that commit.
Open that issue and close this one? Or keep this one open?
Comment #6
mradcliffe$this->options['group_columns'] needs to have appropriate columns set as default to fix the text field issues.
Fixed by including format in group columns. That should have been obvious. Crap.
Comment #7
dawehnerIf the initial part of the issue is solved, it nearly all the times helps to create a new issue.
Less comments etc. Thanks!
Comment #8
Rob_Feature commentedCreated an issue for _text_sanitize over at #1219054: Undefined index: format in _text_sanitize()
Comment #10
reg commentedI added a field to the content type (articles) and because I had aggregation on I got lots of errors.
Then I added it to views (field area) and it went away, then I deleted it and the errors returned.
Sorry I don't have more information, still working on it.