Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
In a majority of the movies so far in this title, we've been working with multiple records. But you'll notice, as you open up each file, that the records aren't in order that really doesn't have any kind of relevance. It's not in alphabetical order. It's not by customer, not by year. So what's happening is when you first open up a FileMaker file and look at multiple records, for example, in the List view, it's going to give you those records in the order in which they were added to the database. In cases of reporting, or printing, or exporting or even just viewing data, that might not always be the desired order. So in this movie, I am going to show you how to sort records in FileMaker.
You might be familiar with sorting from other applications, but in FileMaker you can sort in any layout and by using a Sort dialog window. There are a couple of different ways to get to the Sort dialog. First, if you go under the Records menu, you'll notice that there's an option called Sort Records, and it also has quick keys next to it. On Mac, it's Command+S, and on Windows it's Ctrl+S. You'll also notice, in the Status toolbar, that we've got a default button called Sort. Clicking on any one of these will get you to the Sort Records dialog, and inside the Sort Records dialog you'll notice that there's always a sort criterion in from the last sort.
If there hasn't been a recent sort, the dialog will be empty. But in the case of this file, you'll notice that we've got criterion in here for AddressState. This is helpful sometimes if you're going back and re-sorting something that you've done moments earlier. Then this way you don't have to do it again twice. But in our case, we are going to hit Clear All, so we can start fresh. As you see, Clear All removes any fields from the Sort Order window on the right. But the window on the left gives you access to all the different fields defined within your table, so you can choose them to be part of your Sort Order.
Keep in mind that whatever field or fields you add to the Sort Order will only sort the records in your current found set. In this case, we've got all of our records in our found set, so all 1,523 records will be sorted. But if I did a search, and it returned 20 records, only those 20 records would have the sort order applied. In the window on the left in the Sort dialog, you'll notice that you've got a dropdown menu. This dropdown menu has a couple of different options on it. First, it says Current Layout, which is whatever layout you are currently on, of course, and also the Current Table, which is the table that the layout is based on.
In the list under Current Layout, it only gives you the fields that are defined on your layout. This will make it particularly easy for just end-users because then they don't have to sort through all the different fields defined in a Table. But if you want to sort on something that's not on the layout, you just pick Current Table (Customers), you'll see every field defined in the table, regardless of whether it's placed in this layout. You'll notice that you can also sort by Related fields, but we'll talk about that in the next movie. Back up to our Current Layout, we are going to choose AddressState. Now, you can either double-click on this to move it to the Sort Order window, or select the Move button.
But you'll notice that in addition to picking the field, you also see these little bars that almost look like cell phone reception bars, on the right. Those represent either Ascending or Descending order, and as you by default Ascending order is going to be your first option. If you wish to change that, you can just select the item in the Sort Order window and choose Descending order; you'll see those bars reversed. We'll also talk about sorting by Custom values, the third option, in another movie. Let's see what happens when we now hit the Sort button. We'll see that all of the records in our Found set, which are all the records in our database, have been sorted now by the State value, and they have been sorted alphabetically.
The reason for that is because the field that we chose, State, is a text field, and therefore it's sorted alphabetically. If there was a number field, it would sort numerically, date field chronologically and so on. The other thing you'll notice is the very first two records were blank records. FileMaker will always put the blank records at the very top of a sort order. So this could be a good way for you to find empty values. You can simply sort by the field that you're looking for the empty values in, and they'll appear on the top of your layout. You should be aware that in order to set expectations with your users, that the blank records will always be on top.
And that's behavior that you'd expect from FileMaker. So, if you are creating reports or instructing users on how to work with found sets, keep in mind that the blank records in the fields will always show up on top, and this is something that you not only want to take into account when you're sorting, but also at the same time it's good way to look for inconsistencies in your data, or find records that don't have any values in them. Another thing that you should know is that once your Sort Order is set, any changes that you make to the field and any of the records in your found set that would impact the sort order will automatically resort. So, for example, if I go into this State field and I say CA and I commit the record, you see now that it's been removed from the AA list, and you'll find it listed under the States of California.
This is something that's called resort, or automatic resort, in FileMaker. This is something that, if you rely on it, you can build it into your programming, but also something good to let your users know about, so that they have that expectation when they are working with found sets. The last thing to note is the active record before the sort. Any active record will remain the record after the sort, as well. So, if you are on the first record in your list, and now you decide that you are going to sort by clearing this and hitting City instead, you'll see Evelyne Rutkin is still the active record, even though the sort order has changed.
You'll notice that we are no longer at the top of the list of our found set, like we were before we did the sort. We are actually towards the bottom of the third of it. That's because FileMaker wants to keep the active record in focus. So keep that in mind when you're using sort orders against found sets. You can also unsort by going under the Records menu and choosing Unsort. It doesn't have a corresponding quick key towards it, but there is a script step that allows you do that automatically. So, keep this in mind when you're training your users, or when you're working with scripts as we'll discuss later in this title. Understanding how to work with sorts is going to help you manipulate data inside of Found sets, so that it can be more meaningful to you and your users.
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 74494 Viewers
80 Video lessons · 129709 Viewers
52 Video lessons · 63949 Viewers
59 Video lessons · 49731 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.