Hi, this is Matt from AppWorks, and we’re going to talk about another best practice video – this’ll  be a pretty short one. This is about sorted relationships.

So I’ve been a FileMaker developer for a really long time and back in the day, if you wanted to do something pretty simple, for example have this list of names sorted by last name, then the only way to do that was to go into the relationship graph and modify the nature of this relationship from customer to person by actually sorting the relationship by clicking this button. This is a feature that’s existed for a good long time, maybe since FileMaker 4, something like that.

You would sort by last name and then you could choose descending/ascending, just like any other sort situation. The problem with this is, as simple as that is and we can see that it works right away – the problem is that all calculations that refer to that table, so basically, at all times when FileMaker needs to look at the person table from the company table, it has to go through that relationship and calculate the sort. For example, if you’re looking at a list from all of your records, like 1000 customers and you’re looking at the name on all of them, you’re going to have a really high price to pay – 10x slower, maybe more, than if you use what I would consider the best practice way, which is what? Let’s talk about that.

Let’s go back to the graph, and undo that. So we’ll uncheck that box. The way to do it that I think is better is, at the layout level at the actual portal. So we go to layout mode here, we click on our portal, and this portal setup box comes up. One of the checkboxes we have here is sort portal records. And so if you click this you get pretty much the exact same thing we just saw – sort by last name Ascending/descending, whatever we want. Click ok. That’ll sort my records. I can see at a glance there they are, they’re sorted by last name. So this is nice, because it gives you the ability to sort differently on different tabs or different layouts. So for example, if you had another layout that showed all the people who worked for this company, and you wanted that one sorted by start date or by first name, or by job title, whatever, you could easily do that. So that’s basically it. Sorted relationships? Don’t use them. Thanks for your time.