Execute FileMaker Data API Portal Limitations

I've been using the new Execute FileMaker Data API script step and I've noticed that portals on the designated layout are limited to returning a maximum of 50 records.

The DataAPI documentation mentions that the default limit is 50 records and you can specify an offset and limit for specific portals:

To return data for specific portal rows, use _offset.portal-name and _limit.portal-name. A portal name can be either the object name shown in the Inspector in FileMaker Pro or the related table name. If you omit the offset and limit values for portal rows, the default for offset is 1 and the default limit for portal records is 50.

While the Execute FileMaker Data API documentation describes how to specify a limit and offset, its only for the parent record:

{
  "layouts": "MyLayout",
  "limit": 2000,
  "offset": 1
}

Attempting to limit a portal like this is not valid:

{
  "layouts": "MyLayout",
  "limit.portalName": 60,
  "_limit.portalName": 60
}

Returns an error like:

{
  "messages" : 
  [
    {
      "code" : "1708",
      "message" : "Unknown key (limit.portalName)"
    }
  ],
  "response" : {}
}

You can change the portal on the layout to restrict the results:

  • disable the scrollbar
  • change the starting row
  • change the number of rows that are displayed

This will work to limit the records, but again you are still limited to the default of 50 records.

One workaround might be to place multiple portals on a layout:

Portal 1: Starting record 1
Portal 2: Starting record 51
Portal 3: Starting record 101
... and so on

Then combining them all together manually from Execute FileMaker Data API results. Seems pretty clunky.

Wondering if anyone has found a way around this?

I've attached the example file I created while testing this out, if you want to experiment for yourself.

PerformDataAPIPortalIssue.fmp12 (336 KB)

Have you considered targeting the layout that carries the records from the portal and getting the related info from the parent table?

Other possibilities: modify the portal on the layout so that it shows more than fifty records. This is known as kicking the can down the road. It solves one instance of a problem, it doesn't solve the problem.

Would report as a bug or improvement request’. Originally Claris Chief engineer Clay Mackel implemented it as a function which would have been amazingly powerful and handy for prototyping in data viewer etc.

Ok grand, well I've submitted it as a feature request here: Execute FileMaker Data API - support "limit.portalName", "offset.portalName"

2 Likes

I would tend to agree - you could add a field to the parent table which holds a count of the child records, and if it's less than 50 you can just query the parent table layout with a single call, if not, then make another call to a layout based on the child table and query for records based on the match key.