Join Cris Ippolite for an in-depth discussion in this video Sorting using buttons, part of FileMaker Pro 11 Essential Training.
- View Offline
FileMaker Pro provides a special interface for sorting your records. That can be viewed by clicking on the Sort icon in the toolbar, or through your Records menu. Sometimes for your users, they may not be as familiar with this Sort dialog box as you are, so instead of providing training for them so that you can view the records in their desired format, what you can do instead is put buttons onscreen for them so that they can sort on values by just clicking on certain layout objects. That way they never have to be bothered with the Sort dialog at all. The most logical way to do this, if you're looking at the List View, is to make your column headers clickable.
For example, if we go into Layout mode, you'll see that the field labels are different layout objects than the fields themselves. The most logical way to do this, if you are looking at a List View, is to make your column headers clickable. You can see that in Layout mode the field label and the field itself are both separate layout objects. Later in this title will be a discussion on the concept of scripts in greater detail, but I'm going to introduce you to the idea of attaching an action to a layout object in this video. If you look at our Customer List in Layout mode, like we got here onscreen, you see that our Header part contains these various field labels.
A field label is a layout object, and in FileMaker any layout object can act as a button and can have a script or script step assigned to it. This means that when you're in Browse mode and a user clicks on the layout object, the assigned script, or script step action, will execute. One of those script steps is the Sort Records action, and that's the action we will focus on in this movie. So, for example, let's say we click on the State field label, and now if we go into the Format menu, you see an option called Button Setup. That's only available when you've actually selected a layout object.
You will notice in the Button Setup window, we've got a list of several different actions, almost all the actions you can perform manually within FileMaker, all available to us to be able to assign to the Button. You can also access the Button Setup by right-clicking, or on Mac Ctrl+Click. That will invoke the same window. Now you'll notice, if we scroll down to the section called Found Sets, you will see that there's an option here for Sort Records. Selecting this option shows other options in the right -hand side of the window; the first of which is whether or not to perform with dialog.
That simply means when a user clicks on this, do you want to pop up the Sort Order dialog window? In this case, we don't want to bother the user with that interface, so we'll click the box. Then when we hit the Specify button, we're able to go in here, and we'll double-click on the State to add sorting by the State field. Then we hit OK, and now we'll see when we go into Browse mode, we'll Save that change. And now as you hover over the field label, you see that a little hand appears, indicating that this is in fact a button.
So when we click on the button, we see that the records are all sorted. Now back in Layout mode, you'll see that I've got two little arrows next to the City. Each of these is an image that I've placed on the layout. Even images are layout objects that we can assign a script to. So I am going to right-click on this first one and hit Button Setup, and I'm going to scroll down to Sort and choose Perform without dialog. In this case, I'm going to say City, Descending order, because you see that's pointed down.
I hit OK on that one, then right-click on the other arrow and choose Sort again, Perform without dialog, but this time City with Ascending order. So now when I go back into Browse mode and save my changes, I will see that when I click on the Down arrow, it will sort all the Cities in Descending order.
If I click the Up, it'll sort them in Ascending order. So this is a great way, if you apply this to the rest of your layouts, to allow your users to sort without them having to work with the Sort dialog window.
- Creating databases from templates
- Creating fields in spreadsheet format
- Creating tables and relationships
- Defining key fields
- Adding validation and auto-enter values to fields
- Managing records, including duplicating, locking, and deleting records
- Creating and managing layouts
- Formatting layout objects
- Finding and sorting data
- Creating calculation fields
- Building reports
- Printing and saving as PDF or Excel
- Writing and triggering scripts
- Using relationships throughout a database