This will be a short post because the new FileMaker 17 feature master-detail portal is simple in explanation and in its use. I won’t go into much detail about how the master-detail feature is set up and used. There’s been great work done already by Beezwax and Soliant Consulting and others. You can read about how this new object works in FileMaker. I want to take the opportunity to clear up a few lingering questions/confusions about master-detail.
It’s a current-found-set portal, really
The idea to keep in mind all the time is that the master-detail portal is simply a current-found-set portal. It shows the records from the current table that are in the current found set. These records completely adopt the attributes of the current found set. If there are 91 records in the found set, 91 records show up in the master-detail portal. If you sort the found set by City and LastName, the master-detail portal will sort the records by City/LastName.
One record at a time
Keep in mind too that a master-detail portal is usually placed on a form view and used as navigation: Detail view of a record on the right, master-detail portal on the left. So there is visible only one record at a time in the form view. Only one record. That means the sorting and filtering I have applied to the found set sort of only applies to the master-detail portal.
What’s in a name?
Finally, the master-detail portal looks like a portal, but it does not operate the same as related-records portals. I wish it looked different somehow or had a different setup dialog. But I assume we’ll all get used to it and be confused only a little while. These portals are portals in name only. They show not related records but current found set records.
Okay, we got the concepts identified. Now let’s turn to some commonly-voiced questions.
Can I apply a sort to the Master-Detail portal?
Yes, this can be done. I can sort the found set of records in any way I want, and the master-detail portal will reflect that. It’s that simple. Since this object is placed on a form view in most cases, I only see one record at a time, so the sort order in the form view isn’t that important. Even if I have navigation buttons on the form view as well as the master-detail portal, I’d want the NEXT button to go to the next record in the portal. So it all makes sense.
Can I apply filter to the Master-Detail portal?
Like the sort issue, this one comes up often because we still think the master-detail portal is a portal like related records where we can apply a filter on the portal itself or in the relationship.
However, again, since the master-detail portal reflects the found set, I can find whatever records I want. I can add a button that finds only records with job description of “CEO”. That becomes the portal filter.
Can I do more with the master-detail portal?
I’m starting to see this a lot. Folks want to be able to do some of the things we’d do with a regular portal: use it as a pick list, add a new record, delete a record, to name a few.
A master-detail portal was meant to show the current found set, to go to a record by clicking on a row (no invisible buttons behind the fields required), and to show the active record. That’s it. Trying to do more with it veers into that ‘hacky’ territory. If we do these things, we’re subverting the normal functionality of the object, and that always comes with issues.
But I want to do more!
To address the functionality I listed above:
- A pick list specifically would be tricky to do. If I want to put a checkbox field in the portal and check it, I’m going to have to PREVENT the built-in functionality of going to the record of the current row.
- I can delete a record for sure, but again, any button placed in the row would first go to that record, then delete the portal row. But it is a workable use case, and one that doesn’t seem to follow other master-detail patterns. I should be able to click on a trashcan button to delete a row without going to it, as my email client allows.
- Master-detail portals do not have the blank row at the bottom into which a new record can be added. It’s best just to add a new record via the form view.
New feature, new thinking
The new master-detail portal is one of the biggest features in the newest release of the platform. It provides us a built in way to show this common user interface pattern. We can throw out complicated self-joins or other amazing-at-the-time methods and instead rely on FileMaker’s way of showing the current found set in a list on a form view layout.
Sure FileMaker is fun to hack on and make it do crazy things, but now that we get new features every year, it is harder to pretend that hacking crazy stuff is a good value for our customers. This feature is really good and really simple, and that is a rare combination. We are going to use it pretty much as is, without much hacking. Hopefully, none 🙂
(Okay, this wasn’t too short, but it is shorter than other posts!)
Also published on Medium.