“Portal” in a Popover in a Portal

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.

The Problem

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:

The Solution

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:

VarietySub-varietyDateSamples
GALSTR12/01/20141
GAL
STR1/12/20151
STFBMD2/10/2015
TEC2/12/20151

And what I saw:

VarietySub-varietyDateSamples
GALSTR12/01/20141
GAL BMD 1/12/20151
STR2/10/20151
STF2/12/2015
TEC

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

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.

Limitations

This is one approach only and clearly has its limitations:

  1. You cannot edit the related data (which in my scenario is not an issue, because we just need to show historical data);
  2. It’s not scrollable. You can only see what’s visible on the space you dedicated for it.

As I said earlier, there are multiple methods you can apply to get the desired result. One method is creating a Javascript table, and show it in a webviewer and utilize ExecuteSQL to find the records. Datatables even lets you sort and search the records right in Javascript. If you want to edit I recommend taking a look at Kevin Frank’s article, FileMaker 13: Popovers in Portals, in which he demonstrates using a hidden popover to load the selected record’s related records in a portal.

Download Demo File

Note: The demo file was updated to include the option to back up the records.

6 thoughts on ““Portal” in a Popover in a Portal”

  1. Bruce Robertson

    Something seems to be seriously missing here. The demo doesn’t work. The popup shows data from records which does not at all match the actual feeding history.

    1. Hi Bruce,

      Replaced the file. Didn’t see the screenshots, but found the issue you were hopefully referring to.

      Thank you.
      Agi

  2. Next time just try using ExecuteSQL and populating the results within a Webviewer. Your results within ExecuteSQL can format the data as HTML.

    Also, with the right JavaScript library, you can do even more than a portal can do with re-orderable columns and integrated sorting. That would be my preferred method. You can even make things look exactly like all your other portals with the CSS.

    1. Hi Matt, I agree. Hence I wrote this is just one method. I was thinking about doing a follow-up post with JS. I’ve done some work with DataTables and I loved it.

Leave a Comment

Your email address will not be published. Required fields are marked *

Are You Using FileMaker to Its Full Potential?

Claris FileMaker 2023 logo
Scroll to Top