0

I am looking for a simple way to make an average or sum of values using views. The values are numeric cck fields. I tried views calc but I don't like the table output. I need just a single number output. If average function does not work inside views 2, I am ok with simple sum of values. I can then use the sum value/number of occurences to get the average. It would be probably best to use global php field or views template files. I can use some help regarding the code. I would probably start with:

<?php 
foreach ($fields as [myfieldname] => $fielddata) {
///put the mat function inside here?
print $fieldname ;
}

Any help with code would be appreciated. Thank you

EDIT: I would go with using global php field since it does not need to create custom template file. The view is very simple - just pulling the numeric cck field values from nodes. Filter set to nodetype called review.

  • first you must decide if you want to go with global php or the template file. and would depend on the setup of the view itself and what fields you want get the avarage of. – Mohammed Shameem Jan 25 '13 at 18:21
  • @MohammedShameem updated. – loparr Jan 25 '13 at 18:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.