Im having trouble rendering fields that use references, the variable from 'available variables' always returns a number rather than the fields content. For example i have a two content types:

content type: section
fields: section name, description

content type: article
fields: article name, body, section (node reference)

So i have a view that shows me a list of articles and shows me the 'article name', 'body' and 'description' (referenced from 'section') and when i use the provided variables for 'article name' and 'description' everything works fine, but when i try to access the variable for the referenced field 'description' it just returns a number.

Any idea whats happening here?

thanks

j

Comments

hcmogensen’s picture

I have the same problem

It looks like the it is returning the nid of the node rather than the nid of the node that is being referenced.

Anybody have a fix for this?

jaymcgraw’s picture

same issue

dean.humphreys’s picture

+1

westbywest’s picture

subscribing. same problem with 7.x-1.x-dev.

lgammo’s picture

This is a serious problem indeed, and needs attention.

lgammo’s picture

After some debugging ...

The original poster has a field called description which seems similar to the field I have. The field I have is a text field and it is implemented as a node (in its own table).

I managed a work around for accessing my field data by rummaging around the contents of the $data variable available in the output section.

I used print_r ($data) to discover the structure until I found out how to get to the value I wanted.

THIS IS AN UGLY HACK. Please no flames.

Ideally, there should be a simple variable access, but that variable now gives you a node reference.

Enjoy...

DerekL’s picture

Yes, a nasty one this.

seanmadsen’s picture

+1

johnv’s picture

Status: Active » Closed (duplicate)

Using $data variable is a good workaround.
This is a duplicate of #1140896: Variable $row does not contain correct values ($data->_field_data does)

lgammo’s picture

This might help avoid my prior hack by using the drupal node and field API.

I had code like this in the output area of a field:

  $node = node_load($data->nid);

  $edit_review = field_get_items('node', $node, 'field_publish');
  $value_edit_review = field_view_value('node', $node, 'field_publish', $edit_review[0]);
  $editing = $value_edit_review['#markup'];

   // Now $editing contains the value of the field.

  }

This type of code may help with these field mentioned above. Please try and share with the group.

szy’s picture

Issue summary: View changes

That's still present bug :/

Szy.