Let me start out by stating that I love popovers. I can cut down on the number of layouts a solution needs when I can just serve the data right up where the user needs it. It’s faster, easier, and leaner. Unfortunately, there are limitations when it comes to working with popovers.
I was working on a client solution where I had to create historical snapshots of records at a current state and create backups of their children, as well. There were two child tables related to each other. The first thing that popped in my mind was just to pop a portal on the popover to show all the related child records. Well, that doesn’t work. Luckily, I quickly realized that it’s a feature, not a bug. You can’t place a portal in a portal, even if you’re trying to mask it as a FileMaker popover. For a list of popover limitations check this blog post out:
My approach is the quick and dirty method here. There are other methods that are more involved; one of them is referenced at the end of this article. I asked the question, “Do I loop through the records and create text fields with the data or do I just create a calculation to show the data?” This is a constant dilemma. There are countless occasions where you find performance issues because of unstored calculations and I usually shy away from that approach unless the record count will be low/and or it’s not visited often by humans. This time I decided to use calculations. In fact, I had to create 15 of them to show the related data. FileMaker 13 introduced the ListOf Summary function. Soon after I put it to work we realized there’s a data display issue: the data was mismatched. At first I assumed my script must have an issue, but the records were indeed created, in the proper order with the proper values. Having a quick chat with my coworker, Martha Zink revealed that function doesn’t respect missing data in fields. In essence it strips out the carriage returns in the list and you end up with all the data on the top of your list, even though some of it belongs to different “rows”. [divider style=”divider_colored_line_2″ bottom_margin=”lessmar2″ align=”left”] What I should’ve seen:
And what I saw:
When working with data, sometimes these errors are hard to notice when all the fields are filled out. Luckily, in our tests our data was random, so it was easier to spot the error. I knew I had to find another method to collect and show the related variety records on the room history popover. [divider style=”divider_colored_line_2″ bottom_margin=”lessmar2″ align=”left”]
Custom Functions to the Rescue
I was recommended to write a custom function. I usually remind myself that if I have a need for something someone must have run into that before. We have a resource called http://www.briandunning.com, where a lot of brilliant FileMaker developers keep adding useful custom functions.
GetNthRecordSet ( fieldName ; recordNumStart ; recordNumEnd )
You tell it what field’s content you would like to get a list of, where you’d like to start (usually at the first record) and where you’d like to end: in my case at the last record (aka Count ( RelatedTable::ID ) ). The beauty of this custom function is that you can actually run it on the same table you’re on to get a list just like in the case of the Summary function ListOf.
This is one approach only and clearly has its limitations:
- You cannot edit the related data (which in my scenario is not an issue, because we just need to show historical data);
- It’s not scrollable. You can only see what’s visible on the space you dedicated for it.
Download Demo File
Note: The demo file was updated to include the option to back up the records.