Hi,

thanks for the 6.x update! Wonderful to get this module in!

I'm using computed fields to calculate prices for some artwork. I'm using views calc to calculate the sum of the artwork prices.
However Views calc seems to handle Computed fields wrong. My field value is in the database, saved alongside other content in content_type_xxxx -table. But views calc query seems to be broken as it tries to fetch the data from a nonexistent table. The computed field is displayed well in normal view.

My error in brief:

when viewing the views calc -view, an SQL error is given (unknown column, references views.inc, line 723). My content type table that has the computed value is called 'content_type_vedos'. The computed field name is 'field_vedoksenhinta_value'. Instead the SQL states that it tries to select the data from 'node_data_field_vedoksenhinta.field_vedoksenhinta_value'. There is no such table as 'node_data_field_vedoksenhinta'! Also, no FROM -statement is made for 'node_data_field_vedoksenhinta' -table.

I'll attach the error in full for all those who want to see it.


user warning: Unknown column 'node_data_field_vedoksenhinta.field_vedoksenhinta_value' in 'field list' query:

SELECT 
DISTINCT(node.nid) AS nid, 
node_data_field_vedosnumero.nid AS node_data_field_vedosnumero_nid, 
node.type AS node_type, '' AS parent, 
'SUM' AS TOTAL_SUM, 
SUM(node_data_field_vedosnumero.field_vedosnumero_value) AS field_vedosnumero_value, 
'' AS field_kehystyyppi_nid, 
SUM(node_data_field_kehyshinta.field_kehyshinta_value) AS field_kehyshinta_value, 
SUM(node_data_field_vedoksenhinta.field_vedoksenhinta_value) AS field_vedoksenhinta_value 

FROM node node 
LEFT JOIN workflow_node workflow_node ON node.nid = workflow_node.nid 
INNER JOIN content_type_vedos node_data_field_sijainti ON node.vid = node_data_field_sijainti.vid 
LEFT JOIN nodehierarchy nodehierarchy ON node.nid = nodehierarchy.nid 
LEFT JOIN content_type_vedos node_data_field_vedosnumero ON node.vid = node_data_field_vedosnumero.vid 
INNER JOIN node_access na ON na.nid = node.nid 

WHERE (na.grant_view >= 1 
AND ((na.gid = 0 AND na.realm = 'all') 
OR (na.gid = 3 AND na.realm = 'content_access_author') 
OR (na.gid = 2 AND na.realm = 'content_access_rid') 
OR (na.gid = 3 AND na.realm = 'content_access_rid') 
OR (na.gid = 2 AND na.realm = 'workflow_access') 
OR (na.gid = 3 AND na.realm = 'workflow_access') 
OR (na.gid = 3 AND na.realm = 'workflow_access_owner'))) 
AND ( (node.status <> 0) 
AND (node.type in ('vedos')) 
AND (workflow_node.sid = 4) 
AND (node_data_field_sijainti.field_sijainti_nid = '129') 
AND (node.nid IN (123,125)) )

GROUP BY TOTAL_SUM LIMIT 0, 10

in sites/default/modules/views/includes/view.inc on line 723.

Comments

likewhoa’s picture

same error here so we probably hit a bug on 6.x. I am using drupal 6.6 F.Y.I

here is my error.

user warning: Unknown column 'node_data_field_test.field_test_value' in 'field list' query: SELECT node.nid AS nid, ((node_data_field_test.field_test_value + node_data_field_test1.field_test1_value)) AS cid6 FROM node node LEFT JOIN content_type_south_side_hospital node_data_field_test1 ON node.vid = node_data_field_test1.vid LIMIT 0, 10 in /home/test/htdocs/modules/views/includes/view.inc on line 723.

query is..

SELECT node.nid AS nid,
   ((node_data_field_test.field_test_value + node_data_field_test1.field_test1_value)) AS cid6
 FROM node node 
 LEFT JOIN content_type_south_side_hospital node_data_field_test1 ON node.vid = node_data_field_test1.vid

Hope this gets resolved soon as I rather not go back to 5.x drupal.

d0t15t’s picture

Hi

w/ Views Calc, Views-6.x-2.1, cck-6.x-2.1, & Drupal 6.8 i get the following error for the SQL query which you can find below... the view works fine w/o Views Calc... any clues what's going on here?

    * user warning: Unknown column 'node_data_field_honorarhhe.field_honorarhhe_value' in 'field list' query: SELECT COUNT(*) FROM (SELECT node.nid AS nid, node_data_field_artikelpublishdate.nid AS node_data_field_artikelpublishdate_nid, node.type AS node_type, '' AS title, 'SUM' AS TOTAL_SUM, '' AS field_autor_nid, '' AS field_artikelpublishdate_value, SUM(node_data_field_honorarhhe.field_honorarhhe_value) AS field_honorarhhe_value FROM node node LEFT JOIN content_type_content_artikelfuerkalendar node_data_field_artikelpublishdate ON node.vid = node_data_field_artikelpublishdate.vid WHERE ((node.type in ('content_artikelfuerkalendar')) AND (node.nid IN (806,731,804,808,787,813,816,823,807,827,828,796,818,832,829,803,836,810,814,831,838,839,833,841,857,855,843,844,840,619,860,846,845,865,849,854,868,847,851,861,858,819,850,859,870,853,830,805,885,873,866))) AND ((DATE_FORMAT(STR_TO_DATE(node_data_field_artikelpublishdate.field_artikelpublishdate_value, '%Y-%m-%dT%T'), '%Y-%m-%d') >= '2008-11-16') AND (DATE_FORMAT(STR_TO_DATE(node_data_field_artikelpublishdate.field_artikelpublishdate_value, '%Y-%m-%dT%T'), '%Y-%m-%d') <= '2008-12-16')) GROUP BY TOTAL_SUM ORDER BY node_data_field_artikelpublishdate_field_artikelpublishdate_value ASC ) count_alias in /home/.perry/dotist/dyss.net/artnet/modules/contrib/views/includes/view.inc on line 697.
    * user warning: Unknown column 'node_data_field_honorarhhe.field_honorarhhe_value' in 'field list' query: SELECT node.nid AS nid, node_data_field_artikelpublishdate.nid AS node_data_field_artikelpublishdate_nid, node.type AS node_type, '' AS title, 'SUM' AS TOTAL_SUM, '' AS field_autor_nid, '' AS field_artikelpublishdate_value, SUM(node_data_field_honorarhhe.field_honorarhhe_value) AS field_honorarhhe_value FROM node node LEFT JOIN content_type_content_artikelfuerkalendar node_data_field_artikelpublishdate ON node.vid = node_data_field_artikelpublishdate.vid WHERE ((node.type in ('content_artikelfuerkalendar')) AND (node.nid IN (806,731,804,808,787,813,816,823,807,827,828,796,818,832,829,803,836,810,814,831,838,839,833,841,857,855,843,844,840,619,860,846,845,865,849,854,868,847,851,861,858,819,850,859,870,853,830,805,885,873,866))) AND ((DATE_FORMAT(STR_TO_DATE(node_data_field_artikelpublishdate.field_artikelpublishdate_value, '%Y-%m-%dT%T'), '%Y-%m-%d') >= '2008-11-16') AND (DATE_FORMAT(STR_TO_DATE(node_data_field_artikelpublishdate.field_artikelpublishdate_value, '%Y-%m-%dT%T'), '%Y-%m-%d') <= '2008-12-16')) GROUP BY TOTAL_SUM ORDER BY node_data_field_artikelpublishdate_field_artikelpublishdate_value ASC LIMIT 0, 100 in /home/.perry/dotist/dyss.net/artnet/modules/contrib/views/includes/view.inc on line 723.

this is what my query looks like:

SELECT node.nid AS nid,
   node_data_field_artikelpublishdate.field_artikelpublishdate_value AS node_data_field_artikelpublishdate_field_artikelpublishdate_value,
   node.title AS node_title,
   node_data_field_artikelpublishdate.field_autor_nid AS node_data_field_artikelpublishdate_field_autor_nid,
   node_data_field_artikelpublishdate.nid AS node_data_field_artikelpublishdate_nid,
   node.type AS node_type,
   node_data_field_artikelpublishdate.field_honorarhhe_value AS node_data_field_artikelpublishdate_field_honorarhhe_value
 FROM node node 
 LEFT JOIN content_type_content_artikelfuerkalendar node_data_field_artikelpublishdate ON node.vid = node_data_field_artikelpublishdate.vid
 WHERE (node.type in ('content_artikelfuerkalendar'))
    AND ((DATE_FORMAT(STR_TO_DATE(node_data_field_artikelpublishdate.field_artikelpublishdate_value, '%Y-%m-%dT%T'), '%Y-%m-%d') >= '2008-11-16') AND (DATE_FORMAT(STR_TO_DATE(node_data_field_artikelpublishdate.field_artikelpublishdate_value, '%Y-%m-%dT%T'), '%Y-%m-%d') <= '2008-12-16'))
   ORDER BY node_data_field_artikelpublishdate_field_artikelpublishdate_value ASC
d0t15t’s picture

installing newest views (views-6.x-2.2) fixed this problem, but now i'm getting

warning: Invalid argument supplied for foreach() in /home/.perry/dotist/dyss.net/artnet/modules/contrib/views_calc/theme.inc on line 156.

likewhoa’s picture

Priority: Normal » Critical

wish I could agree with you but still getting SQL error on multiple column calculations.
using Drupal 6.8, Views 6.x-2.2 & Views Calc 6.x-1.0-rc/6.x-1.x-dev

d0t15t’s picture

weird... w/ exactly the same set up my SQL probs were fixed, but it's definitely not doing any calculations - just the above mentioned problem w/ the theme not resolving... anybody else?

karens’s picture

Status: Active » Closed (duplicate)

Something in Views changed after I first got this module working (and yes it did work at one time). The bug is coming from the new Views optimization where it removes tables that are used more than once. In this case I still need those tables, so I have to find a work-around. There are numerous duplicate reports of this same problem so I'm going to keep #358459: User warning: Unknown Table 'node_data_field open and close the others.