I have two node types, a task and a project. The task has a node reference field to reference a project that it belongs to (you create an task and assign it to an project).

I have created an view to display a list of tasks. In the view i have a link to another view that takes the nid of an project as an argument. To do this i have rewritten the link of this field using a token that was available according to the views interface.
The new link is to: projectlist/[field_project-nid]

The problem is that this token doesn't seem to work.
The link is output as https://intraweb.*MASKED*.se/tasks/projectlist/%5Bfield_project-nid%5D
If i use the [field_project]-token, the token is replaced as it should.

Thanks for any help. Hopefully this is easy to replicate.

Comments

geek-merlin’s picture

Priority: Normal » Major

confirming this.
setting prio mojor as imho this is a showstopper for any linking using noderefs.

geerlingguy’s picture

Ditto here. My page just has [field_list_parent-nid] output to the screen...

For a quick workaround, though (if you'd just like the nid of the related node):

  1. Add a relationship to the view: under 'Fields,' select the field that's your node reference, and set it up appropriately.
  2. Add the "Content: nid" field to the view, and choose the relationship you just set up.

Voila! A bit more annoying/complicated than just using the token, but at least you can fish out the nid that way.

herb_miller’s picture

Ditto re the [field_*-nid] only expanding to %5Bfield_*-nid%5D

The workaround in #2 is the same as for D6 - http://drupal.org/node/389418#comment-2469750

For my workaround I chose a much simpler solution.
I am now using a link type field rather than a node reference
So where I was getting 'About' for nid:1 (expansion of [field_node_ref])
I just use a link type field with a name of link and a value of 'content/about'.
So I now refer to [field_link] in the rewritten link path.

I also noticed that in all subsequent fields in the view the [field_*-nid or whatever ]replacement pattern is not listed.
I assume this means these alternative values are only available in the 'current' field.

mail@victorquinn.com’s picture

Same problem here. Subscribing

mvc’s picture

Issue summary: View changes
Status: Active » Closed (duplicate)

duplicate of #1435958: I have lost the ability to use "sub tokens"

(that issue was opened later, but it includes more information about possible workarounds)