Capturing and Recreating Found Sets in FileMaker Pro 2025

FileMaker 2025 offers a new function and script step that, together, will revolutionize how you work with found sets. The GetRecordIDsFromFoundSet ( type ) function captures a list of IDs representing the records in your found set. Additionally, the Go to List of Records script step takes a list of Record IDs and finds the records associated with them, ordering the resulting records to match the order in the list you provided. Together, they allow you to memorialize and recreate found sets easily and with excellent performance.

Capturing the Current Found Set

Over the years, FileMaker developers have tried a variety of techniques for capturing a set of IDs that represent the records in a current found set. Often, these IDs are used to recreate that set in a different window or to restore that set in support of that perennially coveted feature, the “back button”.

One technique involves adding a “List of” Summary field to each table. Another simply iterates through the found set to build a list of all record IDs. Unfortunately, both techniques get bogged down as the found set starts to get large.

Enter the new function, GetRecordIDsFromFoundSet ( type ), which captures a list of record IDs quickly and succinctly. At first glance, you might expect it to return any “type” of ID field you might choose. Instead, it generates a list of Record ID values, and the “type” parameter determines the nature of the results you receive.

For context, the Record ID in question is the same thing that is returned by the Get ( RecordID ) function. It is the normally invisible serial number that FileMaker Pro uses to uniquely identify – and track the creation order of – all records in any given table.

The function returns results in different formats depending on the “type” parameter that you pass to it. The parameter can have a value of 0 to 4, returning the following result types:

TypeType NameExample Result String
0Value Array (return-separated list)4¶1¶2¶3¶5¶
1JSON String Array[“4″,”1″,”2″,”3″,”5”]
2JSON Number Array[4,1,2,3,5]
3Value Array with Ranges4¶1-3¶5¶
4JSON Range String Array[“4″,”1-3″,”5”]

While any of these result types can be used to recreate a found set, you will likely choose different ones to support specific goals in your code. [GIVE EXAMPLE]

However, if you are working with large found sets, the result type 1 can help you manage variable size because (A) it uses the simplest delimiters and (B) it condenses sequential Record IDs into a range rather than listing them individually.

Note that ranges are only applied to sequential Record IDs when the function encounters them in ascending order. If you have a found set with Record IDs of [1,2,3,4,6], you will receive a result of [1-4,6], but if you have a found set with [6,4,3,2,1], no range will be applied.

Note that, as in the example, the Record IDs don’t all need to be in ascending order (i.e. 4,1,2,3,5). Any sequential numbers within the list of values will be condensed into a range.

Let’s say you have the following Contacts table with 6 records:

Record IDName
1Jen Bobbington
2Elspeth Woo
3Hamza Shapiro
4Mustafa O’Connor
5Kiyoko Greene
6Eglantine Cloudhunter

If your found set omits “Jen Bobbington” and “Kiyoko Greene” and is sorted by Name:

Record IDName
6Eglantine Cloudhunter
2Elspeth Woo
3Hamza Shapiro
4Mustafa O’Connor

And then you perform the script step:

Set Variable [ $recordID_list ; Value: GetRecordIDsFromFoundSet  ( 4 )  ]

The variable will be set to: [“6″,”2-4”] because Type 4 is JSON Range String Array.

KEEP IN MIND:
The Record IDs returned by the function are contextual. They are only unique within their specific table, so their meaning is ambiguous unless you track their context. For example, this is especially important when you are recreating a found set.

Without any further scaffolding or architecture, you can now capture key information about a given found set: which records are in the set and what order they are in. And now that you have a list of Record IDs, it’s time to put them to work using the new script step!

Recreating the Found Set

The companion script step, Go to List of Records, enables you to recreate a found set based on the results returned by the function. Until now, FileMaker Pro developers have used two main techniques for recreating a found set of records based on a list of record IDs:  using the Go to Related Record step using a multikey on the relationship match or by performing a Find consisting of multiple requests, one for each record ID to be found.

While these have worked, they have suffered from performance issues when large numbers of records are involved. Furthermore, both approaches return a set of records in creation order (unless the GTRR relationship is sorted, in which case that order is used). If a different record order is desired, the Sort Records step must be included, which impacts performance further. Perhaps even more crucially, the existing order of a found set of records cannot easily be recreated.

But Go to List of Records allows you to specify a series of record IDs in any order you choose, including the order returned by the GetRecordIDsFromFoundSet ( type ) function.

The records are returned in the context of a given table occurrence (current or specified) in the same order as in the list, bypassing the need for sorting the records. For example, given the previously mentioned Contacts table, where your found set omits “Jen Bobbington” and “Kiyoko Greene” and is sorted by Name:

Record IDName
6Eglantine Cloudhunter
2Elspeth Woo
3Hamza Shapiro
4Mustafa O’Connor

If you perform Go to List of Records [ “6¶2-4¶” ] in another window that has the same context, the same found set and sort order is recreated.

What’s more, the script step is very fast, especially when compared to alternatives in FileMaker, such as Go to Related Records: less than 200ms for 70,000 records. Smaller record ID lists are even faster.

Using ranges does not appear to impact performance, but as noted above, it can help to manage variable sizes for large record sets.

KEEP IN MIND:

  • The Record IDs only have meaning for a given context, entered as an option for the script step.
  • If some of the Record IDs in your list do not exist, the existing records are displayed, and error 101 is returned.
  • If none of the Record IDs in your list exist, no records are displayed, and error 401 is returned.
  • Although a sort order is applied to the results, FileMaker Pro does not remember that the records were sorted by Name. Instead, you see the following:
Sort Order

An exciting use case for this pair of new features (function and script step) is recreating the client-side found set when performing a subscript on the server (when that process needs to work with the same set of records). The performance hit for doing this is much lower, in many cases imperceptible. If you’d like to compare, we blogged the performance of previous techniques here.

What other use cases can you imagine? It’s a new day when a fully functional Back Button is on the horizon!

Launching New FileMaker 2025 Features

Our team has hit the ground running with FileMaker 2025, helping our clients understand the best way to upgrade and the most impactful features to launch in their systems. Need help? Contact our team to talk with an experienced FileMaker consultant.

Don’t miss our other FileMaker 2025 blog posts. Our team is weighing in on critical changes and the best new features for your application.

5 thoughts on “Capturing and Recreating Found Sets in FileMaker Pro 2025”

  1. Nice writeup. Holy cow this function is fast!
    I get the following when I use it:
    0 = Value Array
    1 = JSON String Array
    2 = JSON Number Array
    3 = Value Array with Ranges
    4 = JSON Range String Array

    1. Thanks, Ron! Thanks for catching that. I’ll doublecheck which results are associated with that parameter, since it sounds like I might have gotten them out of order. And I agree, the function is impressively speedy!

    2. Hi Ron, confirming that you have the proper order for the different result formats. I’ll correct the blog post now.

    1. Hi Marc, FMP considers the resulting found set sorted, so get (SortState) returns 1. However, if you select Sort Records from the menu, you will see the existing sort order as “Predefined Order” (in angle brackets) rather than a more specific field-based sort order — see the screen shot in the article if you’d like a visual.

Leave a Comment

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

Scroll to Top