Date Range Chooser


Are you looking for a reusable tool to be integrated with your FileMaker solution that provides an easy to use date range chooser popup window? Look no further! Portage Bay has created the Modular Date Range Chooser which can easily be added to your solution, either by copying and pasting the components into your existing solution, or linking the file as an external widget file.

Preset Date Ranges

After the script is called to open the Date Range Chooser window, the script will pause, allowing the user to interact with the chooser, entering either a custom date range or selecting one of the preset date ranges. The preset date ranges are as follows:

  • Today
  • Yesterday
  • Last Seven (last seven consecutive days, inclusive of today)
  • Last Week (last full week Monday through Sunday prior to today)
  • Month to Date (first day of the current month throughout today)
  • This Month (first day to last day of current month)
  • Previous Month (first day to last day of prior month)
  • Year to Date (first day of current year through today)
  • This Year (first day to last day of current year)
  • Previous Year (first day to last day of prior year)

Error Validation

If there are any errors such as an invalid date range, missing end date, or missing start date, error text will display in red and you will be unable to continue the date selection process without correcting the date range. The cancel button will of course still be available.


  • Must be FileMaker version 16+ ( the technique uses JSON in the required scripts)


INTEGRATION A: Install as Widget (Preferred Integration)

  1. Host this file on your server (if your solution is hosted) or put in the same folder as your main solution.
  2. Create a new script in your main solution that has the following steps (see DateRange Example for an example). You can also copy and paste the DateRange_Example script into your main file and edit it as needed.
    •  Perform script from external file (this file) called “DateRange_Controller”, passing any optional parameters as json
    • Capture script result after “DateRange_Controller”. The script result is retuned as json, so it will need to be parsed for start and end dates.
  3. Open your solution and add a button to the layout where you’d like to call the DateRange chooser pop up from. Attach the script you created in step 2.

INTEGRATION B: To copy this example into your solution

  1. Copy the table “DateRange” into your solution. (This step is not necessary if you already have two global date fields in your solution – one for Start Date and one for End Date)
  2. If you followed Step 1, a layout should have automaticaly been created in your solution called “DateRange”. If you did not do step 1, please add a new blank layout called “DateRange”. The Table Occurence is not relevant as there will only be two global fields on this layout. Make sure this layout is using the “Universal Touch” theme or “Minimalist” theme. Delete the Header and Footer Parts. Delete any objects from this layout.
  3. Copy custom functions “WindowInfo” and “WindowCenter”
  4. Copy the entire script folder called “DateRange”
  5. Copy all objects on the layout called “DateRange” and paste them in your solution on the “DateRange” layout. These objects are using the Universal Theme layout available only in FM 17, however copying and pasting into FM16 will still keep the styles. You will also need to resize the vertical and horizontal size of the layout fit the layout objects.
  6. Update the “DateRange Settings” script to point to the global date fields you wish to use as your Start Date and End Date. If you followed step 1, and are using the global date fields from the DateRange module, you will not need to update this script.


To test the DateRange module (or implement it as button), you can add a button to any layout in your solution. Attach the script called “DateRange Example” to the button.

The parameters are all optional, but we’ve added them to give you more options to control the size and location of the window. All parameters are passed as a JSON object. If you are unfamiliar with JSON, please see the “DateRange_Example” script for an example of how to format it. Below are the three optional parameters. If no parameters are passed, the window will default to a Card window centered within the parent window.

  • Left: Number of pixels window should appear from the left edge of the parent window.
  • Top: Number of pixels window should appear from top left edge of the parent window.
  • Window Type: Either “Card” or “Dialog” (a Card window is stationary, automatically dims the background of the parent background and cannot be moved, whereas a Dialog window can be moved although the background will not be dimmed).


The module can be downloaded over at the Portage Bay Solutions blog page

Set Fields With Values

A simple re-usable script for performing the everyday task of setField with optional actions such as refresh and go to object. Multiple setField actions can be performed. It is particular useful as the target of a script trigger.

The setFieldsWithValues script can be used as is on any layout in any file. The script is driven by the script parameter supplied.

Rather than creating many similar scripts to perform similar tasks on different layouts here a single script script is re-useable anywhere by supplying specific instructions in the script parameter when the script is run. Script parameters can be created, edited and saved as snippets in a text editor. The intention is to save development time and to simplify a FileMaker solution by using abstraction.

Basic usage is to set a field with a value, or with no value to clear the field. Many fields may be set with many values at the same time. In addition the set field actions may be preceded by a confirmation dialog and succeeded by various everyday actions such as commit record, refresh widow or portal or object and go to object.

I find this script saves me writing lots of small layout specific scripts where a single step button will not suffice or where i would like to add a single step action to a scriptTrigger. Among many other uses I find this script very useful with Selector Connector for setting a bunch of key fields onRecordLoad.

The sample file with simple usage examples is available here on GitHub

If you are not familiar with GitHub: how to download the zip file from GitHub


The script requires 3 custom functions: CustomList(), #() and #Assign() so it is not strictly modular however it is offered here in case anyone else finds it useful. One day, when I have time, I may see if the script can be made more modular by scripting those functions. Suggestions for this are welcome.

Important: if you want to install this module you must install the required custom functions  before installing the module.

Example Script Parameters:

These examples are meant to illustrate the kind of things that can be done using this script – they are not meant to be used as shown.

Example 1.

#("targetField1" ; GetFieldName ( SELECTOR::ID_ELEMENT ) )
& #("value1"; Element::id )

Example 2.

#("targetField1" ; GetFieldName ( SELECTOR::ID_FUNDAMENTAL ) )
& #("value1"; Fundamental::id )
// Set/reset defaults
// Select first image
& #("targetField3" ; GetFieldName ( SELECTOR::ID_IMAGE ) )
& #("value3"; Fundamental_ImageFolder__Jn___Image::id )
// Clear the movie selector
& #("targetField4" ; GetFieldName ( SELECTOR::ID_MOVIE ) )
// Clear the audio-file selector
& #("targetField5" ; GetFieldName ( SELECTOR::ID_AUDIOFILE ) )
// Clear Web-links
& #("targetField6" ; GetFieldName ( SELECTOR::ID_WEBLINK ) )
// clear the Doc Selector
& #("targetField7" ; GetFieldName ( SELECTOR::ID_DOC ) )
// load default folders
// Load the top level Image Folder
& #("targetField8" ; GetFieldName ( SELECTOR::ID_IMAGEFOLDER ) )
& #("value8";
ExecuteSQL (
"SELECT " & SQLFieldName ( ImageFolder::id ) &
" FROM " & SQLTableName ( ImageFolder::id ) &
" WHERE " & SQLFieldName ( ImageFolder::id_fundamental ) & " = ?
AND " & SQLFieldName ( ImageFolder::isTopFolder ) & " = 1";
"" ; "" ; Fundamental::id
// load the Top Movie Folder
& #("targetField9" ; GetFieldName ( SELECTOR::ID_MOVIEFOLDER ) )
& #("value9";
ExecuteSQL (
"SELECT " & SQLFieldName ( MovieFolder::id ) &
" FROM " & SQLTableName ( MovieFolder::id ) &
" WHERE " & SQLFieldName ( MovieFolder::id_fundamental ) & " = ?
AND " & SQLFieldName ( MovieFolder::isTopFolder ) & " = 1";
"" ; "" ; Fundamental::id
// load the Top Audio-File Folder
& #("targetField10" ; GetFieldName ( SELECTOR::ID_AUDIOFOLDER ) )
& #("value10";
ExecuteSQL (
"SELECT " & SQLFieldName ( AudioFolder::id ) &
" FROM " & SQLTableName ( AudioFolder::id ) &
" WHERE " & SQLFieldName ( AudioFolder::id_fundamental ) & " = ?
AND " & SQLFieldName ( AudioFolder::isTopFolder ) & " = 1";
"" ; "" ; Fundamental::id
// Load the Top Doc Folder
& #("targetField11" ; GetFieldName ( SELECTOR::ID_DOCFOLDER ) )
& #("value11";
ExecuteSQL (
"SELECT " & SQLFieldName ( DocFolder::id ) &
" FROM " & SQLTableName ( DocFolder::id ) &
" WHERE " &SQLFieldName ( DocFolder::id_fundamental ) & " = ?
AND " & SQLFieldName ( DocFolder::isTopFolder ) & " = 1";
"" ; "" ; Fundamental::id
& #("commit"; True )