Best of 2021: Multi-Row Portal Selection

By Daniel Wood, 18 November 2021

multi row portal selection teaser

This is a great UI technique I use all the time when I wish for a user to be able to select multiple rows from a portal. Rather than laboriously single-clicking rows it is much more intuitive to give the user an operating system like experience for file selection. By this I mean the use of modifier keys to select multiple rows:

  • Single-click for single row selection only
  • Cmd / Ctrl click for arbitrary multiple row selections
  • Shift-click for selecting a nominated range of rows.

Further to the above, functionality can be extended through the use of buttons (or my preference of custom menus) to carry out select all/no rows.

To start with, grab my example file here so you can follow along and explore the technique for yourself.

What you'll see in the demo is a portal like this in which selecting rows by Shift-clicking or Command-clicking lets you create an ad hoc selection of items from the list: 


multi row selection

In the picture above we have a simple portal with 3 rows selected. The primary key values of the selected rows are stored in a field/variable of your choosing for use however you see fit.

This is achieved with the following components:

  • A portal of records (obviously!)
  • A script run from within the portal context
  • A field to store the selected Primary Keys
  • A secondary helper field to store the last selected Primary Key
  • A custom function to help identify the pressed modifier keys (in english)
  • A field on the child table to obtain the found count of portal rows.

The last item on this list is purely for the script to know how many records it is dealing with for certain scenarios. The easiest way to achieve this is through an unstored calculation on the table set to the Get ( FoundCount ) function. For more on this technique refer to my earlier article here.

The script accepts the following parameters in JSON:

  • id - The id the user has selected.
  • force - 1 if you wish to force selection of the id, rather than toggle it.
  • all - 1 if you wish to select every portal row.
  • clear - 1 if you wish to clear every portal row.

The script has been mostly abstracted, there are just 4 components to set up as shown below (These could very easily just be added as script parameters as well if you wish making the script 100% abstracted for use throughout your solution).


top 5 of 2021 2

We simply need to specify, in the script, the fields for storing selected ids, the last selected id, the portal primary key, and a field to tell us how many records there are.

The script takes care of the rest and handles the various modifier key situations.

NOTE:  This technique only works right now for portals that do not use portal-level filtering and sorting – it is for relationship level sorting and filtering only. This is because our script does not do any recursive looping through portal rows to achieve selection (something that would be required if portal level filtering/sorting were to be used). 



Example File

What FileMaker Weetbicks article wouldn't be complete without an example file? In this you'll find everything discussed in the article. I think the best way to learn is to jump in and explore.

Click here to download the example file

We love feedback so please leave a comment if you have anything to say - even if you don't it would be nice to hear from you :) 



Something to say? Post a comment...


No one has commented on this page yet.

RSS feed for comments on this page | RSS feed for all comments

Categories(show all)


No Tags