Call us today at
This is Part 1 in a multi-part series about using the location functions in FileMaker Go.
In version 12, FileMaker introduced the Location and LocationValues functions for FileMaker Go. I think it’s fantastic that the database in my pocket doesn’t have to ask me where I am. But I don’t see folks using the Location functions in proportion to how awesome they are, so I feel the need to evangelize them.
Location and LocationValues use the various location-sensing techniques built in to iOS devices to tell you where you are. Since FileMaker can only count on iOS devices to have these abilities, the location functions only return a meaningful result in FileMaker Go. The functions both return nothing in FileMaker Pro, Pro Advanced, and in server-executed scripts. Different iOS devices use different methods to get their locations. You don’t have to write your FileMaker calculations or scripts any differently to use the different methods — FileMaker and iOS handle that for you — but the different methods will affect the accuracy of the results you get.
iPod Touches and WiFi-only iPads do not have GPS sensors, so they are limited to using the locations of nearby WiFi base stations to triangulate a position. It’s better than nothing. iPads with cellular data radios and iPhones use Assisted GPS and GLONASS to get a more accurate position.
The Location function returns your device’s latitude, longitude, and horizontal accuracy (in meters) separated by commas. (FileMaker’s documentation for the Location function does not mention horizontal accuracy, but it’s there. FileMaker knows about the issue.) FileMaker will try to get a location fix good enough to match the requested accuracy; but if it can’t get a good enough fix within the timeout, the Location function will just give you the best it has so far. Sometimes, Location will even give you a better accuracy than you requested.
Location ( 10 ; 5 ) = +34.755136, -82.268791, +30.000000 // for example
We usually want to work with latitude, longitude, and accuracy separately. We can parse them out with the MiddleWords function.
The optional timeout defaults to 60 seconds if you leave it unspecified. That’s a long time to ask users to wait for anything, so it’s usually a good idea to set it to something more tolerable like 5 seconds.
If you don’t have Allow User Abort turned off, users will have the option to cancel any location fix that takes more than a second or two. If the user does cancel, the function will return the best location it has so far, as if the timeout parameter were set for the moment the user chose to cancel. I recommend leaving Allow User Abort on when using the location functions. Users tend to feel less frustrated and helpless when they can cancel a location fix that is taking too long.
The LocationValues function returns more details, and delimits its results with returns instead of commas.
LocationValues ( 10 ; 5 ) = 34.755132 // Latitude -82.268789 // Longitude 277.996552 // Altitude (meters) 5 // Horizontal Accuracy (meters) 3 // Vertical Accuracy (meters) 0.024636 // Age of location data (minutes)
Since the LocationValues result is return-delimited, we can use the GetValue function to extract individual details.
In practice, I use the LocationValues function every time. Even when I’m not interested in the other details, the Age value is useful for knowing if I actually have a new location. If you try to get a new location fix within a several seconds after your previous fix, FileMaker may just give you the previous cached fix instead of actually getting a new one in order to save battery life and return a result more quickly. The Age value is the key to knowing when this has happened. You can calculate a time for the location fix, save it to a global variable, and compare against it the next time you get a location to determine whether you have new data or not.
If you’d rather copy & paste the example scripts I’ve already created for this than recreating them yourself, here’s the file: Location.fmp12
September 18, 2014
August 29, 2014
August 27, 2014
August 18, 2014
August 14, 2014
August 7, 2014
The Scarpetta Group worked to first fully understand our business processes and then built a corporate data management system around our operations that handles everything we do at SmartTruck – from traditional customer account management to managing our shipping and billing requirements.
It’s great to work with proven database programmers that get our business and our needs. The Scarpetta Group has been great to work with to create all sorts of business solutions to help us run our business.
The Scarpetta Group has made our FileMaker experience smooth, fun and worry free. I can already envision how the new system will save us more time and money and take our customer satisfaction to the next level.
#JarvisCRM Wrapping up Version 1.5 Ready for @filemaker_pro @filemakergo iPad and iPhone. Stop buying expensive CRMs. http://t.co/HBZJRxXT2Q
Function Review: Get(WindowMode) http://t.co/YYmkZF8FuB
Come chat with us at @TechAfterFive at Grille 33! We'll be here until 7:30.
© Copyright 2014 The Scarpetta Group, Inc. All Rights Reserved
FileMaker Business Alliance Platinum Member
425 North Main Street, Suite D, Simpsonville, South Carolina 29681
FileMaker and the FileMaker logo are registered trademarks of FileMaker, Inc.
All other trademarks are the property of their respective owners.