UPDATED! Download an easy-to-use and integrate modular tool for choosing a date range

UPDATED! Download An Easy-To-Use And Integrate Modular Tool For Choosing A Date Range


GO TO OUR NEWEST POST TO DOWNLOAD THE FREE DATE PICKER ADD-ON


Updated download

We originally wrote about our tool, the Modular Date Range Chooser, in October of 2018. Not long ago, a reader of the blog was integrating the demo into their Claris FileMaker solution and found a couple of issues.

Two bugs have been fixed

The reader reported these two things:

  • The CANCEL button didn’t work in his solution, although it did work in the demo file.
  • The code in the scripts was missing the steps to enter custom dates. The calendar pop-up would let him choose a date, but then didn’t put that date in either the start date or end date.

We’ve confirmed the two issues, made some changes, tested the results and are now re-posting this blog with an updated demo file.

Vintage typewriter with the word Update typed on the paper

Give it a try

Take a look and see what you think, and let us know how you are using this file in your own solutions. Also, be sure to check out the other free add-ons and demos we’ve offered over the years.

We’re glad to assist

If you have any questions or would like assistance integrating the Modular Date Range Chooser into your solution, please contact us below or schedule a Calendly call .


Original Post

Continue reading below for the text of our original post from 2018, by Kate Waldhauser.

Are you looking for a reusable tool to be integrated with your Claris FileMaker solution that provides an easy-to-use date range chooser pop-up 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.

The benefit of using the file as a widget is that it can be linked with any Claris FileMaker solution.

A card window widget is a very DRY (don’t repeat yourself) approach to coding, so you can easily integrate the same feature with multiple solutions without having to recreate it each time.

So for example, if you have a CRM and wish to use the tool to select a date range for generating reports, you can link the widget with your CRM.

If you also have a database used to manage sales and products, you can link the widget to this file also, providing the capability to select a date range.

It takes just a few minutes to link the widget to an existing file and then can be reused time after time.

If you choose to use the copy and paste method, the date range chooser functionality will be integrated into your existing solution, but there is a higher risk of missing a step, breaking something when doing so, or having trouble upgrading to a newer version of the date range chooser later.

About the technique

The minimum version for the file is FileMaker 16, as this technique does use JSON in the required scripts.

The file uses the Universal Touch theme, standardizing the look and feel and making it easy to match any existing solution. It also ensures the buttons and layout size can be easily used in an iOS or web solution.

Screenshot of Layout mode in FileMaker, showing the Universal Touch theme and options

Script parameters

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).

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:

Screenshot of Date Range Chooser window from the FileMaker Pro solution
  • 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)
Screenshot of what error validation looks like within the Date Range Chooser window

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.

Script results

Once a valid date range is chosen and the OK button is clicked, the script will return a result formatted as JSON that contains both the start date and end date. You can parse these results in your calling script and then do whatever you like with those dates.

How to integrate

Follow the instructions in the “DateRange README” script available in the demo file. This includes instructions on both incorporating the widget into a solution or linking it to an existing solution as a widget file.

Screenshot of scripts available in the Date Range Chooser file

Leave a Reply

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