Download & Extend

Blank Result when using relationship

Project:Views Calc
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

I have:
- latest released (not dev) versions on Drupal 6 as of 3/28/09
- cck field with an integer value on node type A
- a nid argument to limit the nodes to related nodes of type A
- view with style Views Calc Table that properly shows a table with the nodes,
but
- on the view edit page, adding an argument and clicking preview does not show the sum line
- visiting a node with the view shows the sum line, but no sums.

I have fiddled around trying every different combination. Further, I have looked through all the issues, but am stuck.

Any help is appreciated.

Comments

#1

You are using values from a relationship? That is not currently working. It's going to be tricky because I have to find the right table name to swap into the query. I'm spending some time on this today. Not sure if I'll find a fix right away.

#2

Title:Blank Result» Blank Result when using relationship

Renaming for clarity.

#3

Karen,

Does this same issue also apply to calculation fields? I am trying to calculate a price per X on content type A. The price is a CCK field on content type A, but the number of X's is on content type B, which is a node reference in A.

I wish I knew enough to help these "referenced" problems along. If there is something I can do to help, please let me know.

#4

Disregard #3
In case others end up here from a search, my solution was:
http://drupal.org/project/computed_field
That module allows field calculations across content types.

#5

subsribing

#6

Any progress regarding that in the dev version ?

#7

+1 here!

It would be nice to have relationship calc working... Is there any chance to get this?

#8

Version:6.x-1.0» 6.x-1.x-dev

bump

#9

Subscribing.

#10

@johnthomas00 Could you explain your solution? Were you able to calculate fields in a view using that module?

#11

Okay I have a workaround.

Using the views_customfield module, you can add a customfield to your view that can contain PHP. I first put the following code into the customfield and viewed it to find the string name I needed:
<?php print_r($data);?>

One you have the string, just replace the above code with this in the customfield:
<?php echo $data->string_name; ?>

I should note also that this didn't work unless I already had the relationship field pulled in above the customfield in the fields section of my view. Since I don't want it to display twice I just set the first instance to not display. I hope that makes sense. Here is a screenshot of the relevant section:

https://img.skitch.com/20110406-rp4peran187cnacqwsgg2b2799.jpg

Also, you need to be using views_customfield dev and install the patch from here: http://drupal.org/node/576264

I imagine a similar approach could be used to build in support for relationship fields out of the box. I think if you need more flexibility the views_customfield module could also entirely replace the functionality of views_calc.

#12

Can #11 be copied to the front page of this module? I find myself referring back to it regularly, both for the fix to the relationship issue, but also to remember how to use print_r($data) to find the field names (I am not a php programmer, so this is not obvious to me).

nobody click here