New Feature: Playlist Center! Pick a topic and let our playlists guide the way.

Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

Surveying the Sort, Filter, and Field options in Views

From: Drupal 6: Online Presentation of Data

Video: Surveying the Sort, Filter, and Field options in Views

By now you have a pretty good sense of how to build queries with the Views module, but there is still one basic area that's kind of hard to teach and that's all the many options you see when you add a Filter field or Sort criterion. That's because while the options are numerous, some of them are pretty are arcane while others are pretty to figure out. We are not going to look at all the possibilities of sorting, filtering and field display, instead we'll just run through a few of the more useful ones to see their effects on our site. The user interface is very similar among those three. So we'll just go through the Filter options by way of example.

Surveying the Sort, Filter, and Field options in Views

By now you have a pretty good sense of how to build queries with the Views module, but there is still one basic area that's kind of hard to teach and that's all the many options you see when you add a Filter field or Sort criterion. That's because while the options are numerous, some of them are pretty are arcane while others are pretty to figure out. We are not going to look at all the possibilities of sorting, filtering and field display, instead we'll just run through a few of the more useful ones to see their effects on our site. The user interface is very similar among those three. So we'll just go through the Filter options by way of example.

We are back looking at our people view, which of course you get to through the Site Building Views Interface I have shown you before. As you know we have already set up the filters so we only see publish nodes of the type person over here. I'm going to add another one so we'll only see those people that have been published and that are of the taxonomy friend, in other words, we'll only see friends of the family. To do that I again click on the Add button here, scroll down, go into my taxonomy group as we discussed groups in other videos, and then click on Term. I want to mention one little tip, the Add Field, Add Filter and Add Sort Options looking awful lot alike, as you can see you can have the same sorts of groups, you see the same list of options and so forth.

More than ones I have been in the middle of a process and forgot what I was doing, I think I was adding fields to the display but was in fact adding filters. Then when I was done I've clicked preview, and after 15 minutes of work the results were nothing at all like I expected. To avoid that get in the habit of checking the text at the top of the options list. In this case we see Add filters as opposed to Add field. There is one other word here I'd like to talk about Defaults. We'll talk about what that means in the video adding view displays as pages, blocks and RSS feeds.

But back to what we were doing, I'm going to add this Filter so we can filter out only those friends. I click on Add, the vocabulary we only have one this relationship to family and I'm going to select drop-down, you could allow people to type-in the selection option but I'm going to have drop-down, and we don't have a hierarchy in our taxonomy, if we did, you could show it this way, but I'll click Update and see what we have. As I said I only want to show those people who are friends, so I'll click there and click on Update. Now we see exactly as we expected only the one person who is listed as a friend. I'll click Save to be sure that everything is set. This seems like a good time to show off one of the Filter tool's most useful features and it's one that it shares with the Sort criteria as well. You can actually expose a control to end users, so anybody can Filter and Sort to their hearts to light. To do that let's go back up to this taxonomy term and click on it. To give our options again you might not have noticed this little Expose button here. All we have to do is click Expose and we get a large group of additional options. Once again I won't explain all of them just a few that are useful.

The easiest way to explain them is actually to show you the results and then come back and change some of them so you can see what it does, I'll click on Update as usual. Now when I look down here at our preview we can actually change the selection, and remember, this is what the user will see. So right now we are showing only Friend. Let's say we only want to see those people who married into the family, click on Married and Apply, there they are. We want to see everybody, we have this choice right here, and click Apply, this is very useful when you are finishing up your site and making it available to users because it gives them so many options of how they see information on your site.

Let's go back up and take look at some of those options click on Taxonomy: Term. Let's get rid of this Force single for example so we could see what that does, un-check it, click Update and go down to our preview. Now we can select multiple terms here and show for example all those people who are both married into the family and raised in the family but not the friends and the pets. You would hold down the Command key on the MAC or the Ctrl key on the PC to select more than one. Click Apply, and indeed we get exactly what we expected. Let's look at a few more of those options, click on Taxonomy: Term, scroll down to our options and let's uncheck the Optional checkbox and see what that does, click on Update.

Now it's taken away that choice to let you show everything, in other words you have to choose some taxonomy term. I'll scroll back up, click on Taxonomy: Term again, and I won't go through all the rest of these options as you can see there are several and they are fairly self-explanatory with the text that appears underneath each of them. So that's how you can expose a Filter. As I mentioned before you can also expose Sort criteria giving people various ways to sort by choosing pop-up menus and selection boxes and so forth. For our purposes though let's remove that option by hiding the Filter from users. Click on Hide right here and then Update and it's back to the way it was, we are only showing friends and we are not giving people an option to see other things.

The last thing I want to do before we leave is I want to get rid of that Filter because it's not actually the way that we are going to use things later in the course, I click on Taxonomy: Term, scroll down, and then I can just click on Remove. Remember, you could also have done this by using that Arrange button right up here, but we can do it one-by -one by just clicking Remove. We see everybody again and click Save. This gives you just a peak into the dozens, if not hundreds of options were changing the sorting, filtering and field displaying views.

The good news is that views has fairly good help commentary throughout its interface and the Advanced help module provide even more. And as always you can get even more instruction on these options by searching on the drupal.org website.

Show transcript

This video is part of

Image for Drupal 6: Online Presentation of Data
Drupal 6: Online Presentation of Data

50 video lessons · 11180 viewers

Tom Geller
Author

 
Expand all | Collapse all
  1. 12m 56s
    1. Welcome
      1m 12s
    2. Reviewing requirements
      3m 35s
    3. Using the exercise files
      3m 11s
    4. Touring examples of data visualization
      4m 58s
  2. 27m 56s
    1. Planning data structure
      8m 26s
    2. Importing and manipulating data
      6m 40s
    3. Looking at Drupal's database
      6m 13s
    4. Deciding whether to store personal data as nodes or users
      6m 37s
  3. 1h 13m
    1. Understanding the Content Construction Kit (CCK)
      4m 57s
    2. Creating new content types with CCK
      7m 26s
    3. Hiding the Body field
      2m 46s
    4. Reflecting CCK field data in the Title field
      7m 28s
    5. Managing CCK field placement
      7m 34s
    6. Exploring CCK's other features
      8m 22s
    7. Using other CCK field types
      3m 25s
    8. Adding date information as a CCK field
      8m 43s
    9. Including images as CCK fields
      10m 23s
    10. Connecting content to existing nodes
      5m 58s
    11. Using taxonomies to categorize and group data
      5m 59s
  4. 53m 54s
    1. Understanding why views are useful
      6m 12s
    2. Using SimpleViews to create basic content views
      5m 49s
    3. Diving into the Views interface
      11m 16s
    4. Adding fields to a view
      7m 12s
    5. Understanding iconic controls in the Views interface
      7m 15s
    6. Surveying the Sort, Filter, and Field options in Views
      5m 40s
    7. Adding view displays as pages, blocks, and RSS feeds
      10m 30s
  5. 43m 34s
    1. Overriding default settings on view displays
      8m 56s
    2. Attaching more information to views
      10m 57s
    3. Improving view appearances with grid, list, and table formatting
      9m 20s
    4. Surveying other basic display settings in Views
      11m 3s
    5. Altering a view's appearance through CSS
      3m 18s
  6. 55m 8s
    1. Importing, exporting, and cloning views
      6m 9s
    2. Controlling access to views
      7m 19s
    3. Learning from built-in views
      5m 52s
    4. Creating views that aren't based on nodes
      10m 6s
    5. Extending views with arguments
      10m 17s
    6. Extending views with relationships
      7m 2s
    7. Going further with relationships
      8m 23s
  7. 46m 40s
    1. Understanding geographic data
      4m 26s
    2. Setting up the Location module
      16m 20s
    3. Entering geographic data with the Location module
      10m 10s
    4. Displaying basic maps with the GMap module
      6m 43s
    5. Integrating the GMap module with Views
      9m 1s
  8. 54m 21s
    1. Exporting data in tabular form
      11m 25s
    2. Planning with the calendar modules
      11m 31s
    3. Using the Charts module and Google Charts
      7m 11s
    4. Graphing data with Open Flash Chart
      4m 50s
    5. Making important data pop out with tag clouds
      7m 46s
    6. Putting it all together in an attractive package
      11m 38s
  9. 36s
    1. Conclusion
      36s

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold

Are you sure you want to delete this note?

No

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.