6 Replies Latest reply on Jul 11, 2014 9:16 AM by philmodjunk

    Location Value or GPS data

    JeremyHurd

      Title

      Location Value or GPS data

      Post

           Hello,

           I'm very new to FM, currently I have FM pro version 13.0.3.  I have a data base that I have created and I would like to be able to add a button that would put the take the current GPS location value (LAT/LONG) and populate it in a field.  I have read and understand that LocationValue is an added feature, but I have no idea on how to make it work the way I want it to.  

           Once again I'm very new to FM and any type of scripting for that matter, kind of learning as I go.  Any help is appreciated!

            

        • 1. Re: Location Value or GPS data
          philmodjunk

               This is a feature that can only be used with FileMaker GO on an iOS device such as an iPad or iPhone. Is this how you need to use this feature?

               It doesn't work in FileMaker Pro on a computer or windows tablet.

          • 2. Re: Location Value or GPS data
            SteveMartino

                 Do you already have the long and lat, or are you trying to populate from an address?

                 If you are trying to populate from an address, you can look at this DevCon session:

            https://fmdev.filemaker.com/docs/DOC-3321#comment-2632

                 Download and unzip the sample files.  In the file marked "GeoLocation Multiple Points", there is a Script that uses a custom function that will take the current address and turn it into Long & Lat.  You can attach this to a button on your PC.  You can also use the other script to geocode all the addresses at once, but it didn't seem to do all the addresses, and I had to go thru the records that didn't geocode and use the first custom function.

            • 3. Re: Location Value or GPS data
              JeremyHurd

                   @PhilModJunk

                   Sorry was on vacation and couldn't check your response until now.  Yes I will be using the Geo locations on an iOS device.  I've got a script running right now that allows FileMaker Go to access the location services and obtain the information, but I can't figure out how to get it to display in a field.

                   When the "button" is pushed, it states "Location received, improving accuracy", and then that's it.  So I know I have it accessing the location, I just can't get it to display the information.  Does that make sense?

              • 4. Re: Location Value or GPS data
                philmodjunk

                     How did you set up the button?

                     Set Field can be used with this function as part of the calculated result setting to assign the current values to a field. The calculation can extract just one value or pull all of them into the field. Since this function returns a return delimited list of values, if you want the whole list, make sure that your field is tall enough to display all the values or use GetValue to extract a specific value from the list.

                     The image uploaded with this comment is a very simple "quick and dirty" test of the function. After testing it, it occurs to me that you might get issues if you request to small an accuracy and the device is unable to produce a value with that accuracy in a timely fashion. (There is also a time out parameter that could affect how long the system tries to produce the requested info.)

                • 5. Re: Location Value or GPS data
                  JeremyHurd

                       @PhilModJunk

                       Thank you.  Yesterday while playing with my script I did exactly that.  I increased the field and all the values show now when I test.  I am now on to trying to parse out some of the data as the listed in the help menu using the GetValue, but having a hard time getting that to work.  All I need is LAT/LONG data, so I have changed from LocationValue which gives altitude, horizontal, etc. to Location, so I just need to get rid of the accuracy part.  If I can t figure it out, I guess I can always shrink the field to eliminate that portion. 

                  • 6. Re: Location Value or GPS data
                    philmodjunk

                         GetValue won't work with the Location function as there are no return separated values returned in that case. The lat and long values are separated by a comma.

                         But you can't "get rid of the accuracy part". You have to specify some accuracy value, though the time out setting is optional. The idea to the time out setting is that you can decrease the time out setting as a way to reduce the number of "fetches" and thus prolong battery life in your device. (Or so I am reading from the FileMaker help entry on this function...)