0

I have a content type called Technique that contains a title field, a description field, and a node reference called "belt level" referencing a content type called Curriculum level. The content in Curriculum level are as follows:

  • Yellow belt
  • Orange belt
  • Blue belt
  • Brown belt
  • Red belt
  • Black belt

I have created an Integer field in the Curriculum level content type called level int. I have set "yellow" to 1, "orange" to 2, "blue" to 3, "brown" to 4, "red" to 5, and "black" to 6. Now I have a view of techniques, in which I want the sort criteria to display results based on the level int field value of the content that the node reference field (called "belt level") in the technique was referencing. The problem I am running into is that I have no way of connecting the two. If I use the belt level field to try to set the sort criteria, I can only sort it alphabetically based on the title. How can I sort it based on the level int field instead?

2

Add a relationship Content: belt level (or whatever your node reference field is called) to the view.

Then add a new sort, choose Content: level int (or whatever the integer field is called) and under 'relationship' choose the one you just added.

That should do it.

|improve this answer|||||
  • I used the relationship Content: level int and it worked, but I noticed that right underneath it was a relationship called Content: level int - reverse. What is the difference between the two? – Ephraim Feb 23 '12 at 22:02
  • 1
    The reverse one is for retrieving content which references that node, rather than the content which that node references. So in this case, Content: level int would return the belt level's integer value, whereas Content: level int - reverse would return all the Techniques that reference the belt level. In this case it's useless but it could be used, for example, on a page listing all the belt colors in order to display a list of techniques belonging to each belt. (Although that's a bad example as it could be done better using grouping). – arkz Feb 24 '12 at 13:46

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.