Building Location-Aware App on FileMaker Go

Version 3

    Ever thought about giving your FileMaker Go application location awareness so it can interact with users and trigger actions automatically based on users’s presence and behaviour? This was made possible by a new script step “Configure Region Monitor Script” and a new function “Get ( RegionMonitorEvents )” introduced in FileMaker 16.

     

    In this article we are going to explore this possibility by looking at a specific scenario: I am the owner of a factory with three workshops. Each workshop manufactures a different product. In order to track my labor expenses for each product, I want to track the time that my employees spent in each workshop using a FileMaker Go app.

     

    For more details please check out the demo file attached to this article.

     

    Here’s what I need to do to get the app built:

     

    Define regions to monitor

     

    First thing I need to to is define regions for FileMaker Go to monitor. In the scenario described above there are three regions to monitor, corresponding to the three workshops. I am going to tag each workshop with a beacon (iBeacon device).

     

    A beacon’s identify is specified using three different parameters: UUID, Major and Minor.

     

    UUID is usually used to identify a large group of beacons that belong to the same organization or person. In most cases you want all of your beacons to share the same UUID.

     

    The combination of Major and Minor is used to identify each individual beacon that share the same UUID.

     

    With this information in mind, I configured the identify of my three beacons to be:

     

    Beacon in Workshop 1

    UUID: 00000000-0000-0000-0000-000000000000

    Major: 1

    Minor: 1

     

    Beacon in Workshop 2

    UUID: 00000000-0000-0000-0000-000000000000

    Major: 2

    Minor: 1

     

    Beacon in Workshop 3

    UUID: 00000000-0000-0000-0000-000000000000

    Major: 3

    Minor: 1

     

    This assumes I have configured my beacons’ emission power to ensure that their covering regions won’t overlap with each other. (This is very important when deploying your own beacons.)

     

    To tell FileMaker what regions to monitor, I am going to create a OnFirstWindowOpen script trigger that will run when the app first open. In this script I will use “Configure Region Monitor Script” script step to tell FileMaker Go to monitor regions defined by these three beacons. As shown in the picture below:

    Configure Regions to monitor.png

     

    Define actions to take

     

    Now that we have told FileMaker Go what regions to monitor, the next step would be telling it what actions to take when the user enters or leaves a region monitored by it.

     

    In my scenario, when a user enters a workshop I want FileMaker Go to create a timesheet record and fill in the timesheet start time. When the user leaves the workshop I want FileMaker Go to fill in the end time of that timesheet. To achieve this, I will create a script called “Timesheet - Check In and Check Out” to describe all the actions involved.

     

    The first thing I want to do in my script is to tell which region the user was interacting with, and whether the user entered or left the region. These information can be retrieved by using function “Get ( RegionMonitorEvents )”.

     

    Get ( RegionMonitorEvents ) function will return information about events that caused the script specified in the Configure Region Monitor Script script step to run in the following format:

     

    <region name>

    <timestamp>; <1 or 0>

    <timestamp>; <1 or 0>

    <timestamp>; <1 or 0>

     

    1 means the iOS device entered the monitored region; 0 means it left the region.

     

    So in my script I will use the following script steps to retrieve and parse out the region name, last event timestamp and last event action.


    Following that I will add script steps to either create a new timesheet to check in the user or fill out the end time to check out the user depends on the last event action. Please refer to the attached demo file for more details about this section.

     

    Grab event info.png

     

    Put the two pieces together

     

    At this point I have told FileMaker Go what regions to monitor and I have created a script to execute a series of actions when a user enters or leaves a monitored region. The only thing left to do is to put these two pieces together by updating my “Configure Region Monitor Script” script steps. As shown in the picture below:

     

    Specify script to execute.png

    After specifying script for all three of them they should look like this:

    What configure region monitor script step should look like.png

    Conclusion

     

    With the ability to monitor geographical regions, not only can FileMaker delivery and capture data at any place and any time, it can do them at the right place and the right time.

     

    Weihao Ding

    Senior FileMaker Developer

    weihao.ding@directimpact.ca

     

    Office : +1 450 663-0005
    Toll free : + 1 888-558-0005

    logo.pngfacebook.pngtwitter.pnglinkedin.png