1

I'm trying to calculate the sum of a list of prices (decimal field) with the views module. And it just doesn't want to work... What am I doing wrong or.. is it just a bug ?

Software used

  • drupal v7.7
  • cTools v7.x-1.0-rc1

View configuration 1

  • Use aggregation: Yes
  • Fields : Title, sumPricesField
  • Aggregation settings of sumPricesField : Aggregation type = SUM
  • Group column = Value

Result 1

sumPricesField remains blank in output, the only aggregation type that gives a value is COUNT

View configuration 2

  • Use aggregation: Yes
  • Fields : Title, sumPricesField
  • Aggregation settings of sumPricesField : Aggregation type = SUM
  • Group column = Value
  • Group columns (additional) = Entity ID result in MySQL error

Result 2

SQL error:

SQLSTATE[42000]: Syntax error or access violation: 1064 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 'id) AS field_data_field_algembeo_entityid FROM
drupal_node node LEFT JOIN drupa' at line 1

Generated Query:

SELECT 
  node.title AS node_title, 
  node.nid AS nid, 
  node.created AS node_created, 
  MIN(node.nid) AS nid_1, 
  'node' AS field_data_field_bedrag_node_entity_type,
  SUM(field_data_field_bedrag.field_bedrag_value) AS field_data_field_bedrag_field_bedrag_value, 
  SUM(field_data_field_bedrag.entity id) AS field_data_field_bedrag_entityid
FROM 
  {node} node
  LEFT JOIN {field_data_field_bedrag} field_data_field_bedrag ON node.nid = field_data_field_bedrag.entity_id AND (field_data_field_bedrag.entity_type = node AND field_data_field_bedrag.deleted = 0)
WHERE 
  (( (node.status = '1') ))
GROUP BY 
  node_title, nid, node_created
ORDER BY 
  node_created DESC
LIMIT 
  10 OFFSET 0
0

1 Answer 1

0

I had the same problem with SUMming up some float fields. I found this patch which solved the issue for me http://drupal.org/node/1194900 The mentioned jQuery error occurs on my site too after the patch but at least the aggregation works.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.