Date Range Chooser

MODULE DESCRIPTION

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.

SYSTEM REQUIREMENTS

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

HOW TO INSTALL

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.

HOW TO USE

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

DOWNLOAD

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

mCalendar

mCalendar is a “context-independent” FileMaker calendar / date picker using only global variables.

This version (v3_mFM) requires FileMaker 13.

Read more