Closed (fixed)
Project:
Views Calc
Version:
6.x-1.0-rc
Component:
Documentation
Priority:
Critical
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
30 Apr 2008 at 18:57 UTC
Updated:
30 Jan 2009 at 21:30 UTC
Jump to comment: Most recent file
Comments
Comment #1
mdowsett commentedI can't get it to work either. Some documentation would be nice as I don't understand the limited help text it provides.
I've created a new 'computed' field for a content type...and have named that field 'total'.
In the 'Computed Code' section of the 'total' field, I put:
$node_field_total[0]['value'] = $node->field_score_t1[0]['value'] + $node->field_score_t2[0]['value'] + $node->field_score_t3[0]['value'];
This is to add up three of my fields (score_t1, score_t2, score_t3).
Questions:
- did I have to rename the first part from the default '$node_field[0]['value']' to '$node_field_total[0]['value']' (to match the name of my field ('total')?
- do I have to adjust the 'Display Format' field code (from the default '$display = $node_field_item['value'];')?
When I do the above, my view gives nothing in that column (not even a '0').
Many thanks.
Comment #2
mdowsett commentedComment #3
Rosamunda commentedKeeping this alive, because I think this is a complex module that really needs some documentation...
:)
Comment #4
mdowsett commentedgood on ya....I agree! This module is just to calculate COLUMN totals right? I can't get my head around this module or the computed field module (trying to do multiple calculation in the same view which doesn't seem to work).
Comment #5
lelizondo commentedI'll try to explain with a very easy example:
Create a content type and add two fields:
Bank Account -> Text Field
Money on Bank Account -> Decimal
Then create some content like this
Bank Account = A345
Money on Bank Account = $300.00
Bank Account = B567
Money on Bank Account = $200.00
Then create a View adding the two fields and select 'Calc Table View' as your View Type.
Go to admin/settings/views_calc and select the view you have just created. Then configure the fields you want to sum, in this case you would like to sum the Money on Bank Account and then select the calculation to perform.
Save and you view should be working.
Hope it helps..
Luis
Comment #6
tindo commentedThanks for starting this post Rosamunda. I cant get this to work either. Thanks to Luis it did help, except I keep getting this error user warning: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause query: im using Drupal 6 and Im not sure about this part:
"Go to admin/settings/views_calc and select the view you have just created. Then configure the fields you want to sum, in this case you would like to sum the Money on Bank Account and then select the calculation to perform." doesnt seem to apply becoz thez nowhere to select the view i just created.
I am trying to use SUM. What i did was i added SUM to the list in views calc settings. then i add the calculation SUM(%node.nid) just to test an this doesnt work. I can see it in views but as soon as i add it to the view i get the error i mentioned and the top. if i use a cck field it also says "unknown field in fieldlist". I feel its probably somthing quite simple but i just cant figure it out. Any advice? Thanks in advance.
Comment #7
lelizondo commentedYou have to select (enable) the view in admin/settings/views_calc, after that you'll be able to select what operation to perform. Never used this module on Drupal 6 but it shouldn't be different than 5.x
Luis
Comment #8
junro commentedHello, 6.x version seems to be more complicated than 5.x...
need an exemple for 6.x please, it's such a terrible module!! ^^
+1 documentation :)
Comment #9
bneel commented+1
Comment #10
tindo commentedAnyone figure out views calc d6?
Comment #11
likewhoa commentedthis has changed for 6.x because you are not giving the option to select which calculation to perform.
Comment #12
likewhoa commentednot yea, I am getting similar error.
I am also trying to create a SUM from a row of fields, also would like to SUM up by day,week,month and or year but so far this module is not working in drupal 6.6
Comment #13
Jonasvh commentedIn drupal 6.6 i've found where you can add the calculations (or whatever) to your views.
Go to the views module and in any kinds of views, you can choose at the section 'Basis Settings', the style.
There you can choose for 'Views Calc Table'
I just try to calculate how many values i have of a field.
Is there anyone who can tell more about the module now.
I hope that this was a help for someone.
Comment #14
jax commentedYeah, some documentation would be nice. The use case I have is this; a content-type with an imagefield that can be added unlimited times. I want to create a view that shows the title of the content-type and how many images it has. In admin/settings/view_calc I added
COUNT(%node_data_field_photo.field_photo_fid)(after enabling COUNT in Settings). But now when I select that field in the view I'm getting the "Mixing of GROUP columns (MIN(),MAX(),COUNT(),...)" error and I can't find out how to add the GROUP clause. Does anyone know how to add/enable the correct GROUP columns?Update:
A temporary (and really bad) solution is to add something like:
in the
query()function inviews_calc_field_handler.incComment #15
likewhoa commentedfor those new to view_calc here is a little run down on usage for both drupal5 and drupal6
Drupal-5.0 usage is explained by lelizondob comment #5 of this bug issue.
for Drupal-6.6 the process is different since views_calc doesn't have a columns tab in admin/settings/views_calc those columns will appear only in admin/build/views when using the style "Views Calc Table" under basic settings. You'll need to click on the settings link to have columns appear for calculations. A step by step process would go something like this.
1. Create your content type with require fields that you'll use in views_calc
2. Create content from your newly created content type
3. Create a view
Style = Views Calc Table
Fields = content fields created in step 1
Filters = Filter by node type create in step 1
4. Click on "Views Calc Table" in Style under basic settings then click on "settings" link right below it.
5. Now just select the columns and calculations, click update then save. Also don't forget to give your view a "page" view link.
For drupal-6.6 as of this comment posting, multiple column calculations will result in a SQL query error. See #321223: Columns with multiple fields
Hope this helps those news with views_calc.
likewhoa
Comment #16
Stephane91 commentedHigh and thanks for the small tuto
It doesn't work for me.
Maybe it's Drupal 6.8 ?
I follow all the steps you indicated but in the end I have a popup button saying "An error occurred at .../fr/admin/build/views/ajax/preview/simpleviews_ncr."
If I try to go to the page directlty with the url : nothing, blank page.
I swith On/off Ajax on preview and on direct access : nothing either.
The trouble is the message is not very "verbose", so I don't know where to dig.
I'm on this for now 4 hours and I give up.
I looking for help.
Thanks everyone.
Conf :
D6.8
MySQL 5.0.41
Apache/2.0.59 (Unix) PHP/5.2.6 DAV/2
Comment #17
likewhoa commentedi haven't tried it with drupal-6.8 will try to reproduce your bug.
Comment #18
alexandreracine commentedComment #19
xcorex commenteddrupal 6.8 here and in admin/settings/views_calc I could only have sucess using the first custom field in views. All other alternatives compositions with anothers custom fields result in errors.
Please, I need this module! And congratulations. Its a nice mod.
Comment #20
arnaldex commentedThis worked for me in v5.x ... thanx!
Comment #21
karens commentedThere were a number of things that originally worked but got broken as Views was further developed. I think I have most of the bug worked out with today's commits. I'll probably roll a new release later today. After that I'll try to get some documentation put together.
Comment #22
karens commentedOK, see documentation at http://drupal.org/node/359981.