I am using Drupal 7 with views, and have created table views for 4 different data sets on my website (Architecture, Theater, Education, Philosophy). For each table view, I need to make the columns alphabetically sortable. I have managed to sort on text fields and date fields just fine, and have found a work-around on making the sort work on fields that are taxonomy terms (as long as the vocabulary used is unique -- i.e. the field in the view is the only one using that particular taxonomy vocabulary on the given nodes/data type set). Unfortunately, bcs of the data that I am working with, in particular for my Architecture data set, the architecture nodes have several fields that share a common taxonomy vocabulary. For example I have fields: "primary architect", "secondary architect", "additional architects", and all of these share the same taxonomy vocabulary called 'agent' (but not the same term value). When I try to sort on these types of fields in the table view I can't get it to work. I have tried the work around with adding relationships (Content: taxonomy term on node) and sort criteria (Taxonomy term: name) that worked for fields that have a unique taxonomy vocabulary but I got duplicates. I tried filtering these by creating new template files and removing the redundant pairs but that didn't seem to work. And now I'm beginning to think that I'll have to write a new module to append views in order to make this work either. Could you point me to where the SQL query is that creates the table row arrays is and/or where I'd need to modify the query to take into account this scenario. Any help is GREATLY appreciated!!!!!
Thank you in advance!

Comments

dawehner’s picture

Category: bug » support
Priority: Major » Normal
Status: Active » Fixed

Passages exists for a reason :)

BCS? You probably don't refer to http://en.wikipedia.org/wiki/BCS_theory

Believe me or not there is no single point where views generates sql. There are multiple different pluggable parts
which works together.

What you have to do is to add a relationship from the field to the taxonomy table, so for example "Content: tags (field_tags)".
Once you have done this you have taxonomy: term and it is possible for you to sort by that.

PS: Issues aren't bugs because you don't know how its working :)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.