Forum Discussion

JIMLIEDER1's avatar
JIMLIEDER1
Qrew Cadet
9 years ago

Can QuickBase receive & display location information from a Field Tech's phone?

A HVAC office wants to be able to view the location of their Field Techs on a Google Map within QuickBase so that they can dispatch the Tech closest to the customer?s location.

The Tech?s all carry company issued Verizon phones, so would it be possible for the phones to periodically send out a message with their location information to a destination that can be read by QuickBase?s new connected tables?

If the phones can?t do this, is anyone aware of a GPS device that?s stored in the service truck that can send out the location info?

  • Yes that is possible if you have a browser on the phone that can access QuickBase and you don't need any special services including connected tables . Quite frankly the more "services" and external components you add to QuickBase the more complicated you are making the solution. Just do everything in script.

    This demo locates the ten closest White Castle stores to the searcher's present location (your problem is very similar technically):

    White Castle ~ Cravers & Sliders
    https://haversineconsulting.quickbase.com/db/bi5963543

    Just add a new Search and permit your location to be shared, save the record and a list of the ten closest (as the crow flies) White Castle emporiums will be displayed:

    White Castle ~ Cravers & Sliders ~ New Search
    https://haversineconsulting.quickbase.com/db/bkkxm2a9w?a=nwr

    Pastie Database
    https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&rid=485

    I created this app so that no matter where I am after hard day of QuickBasing I can find my nearest White Castle.

    Notes

    (1) There are no approximations involved in the distance calculations. The trig functions are calculated Client-Side using JavaScript because QuickBase does not have trig functions in their formula language. The essential formula for these calculations is the Haversine function which calculates the great circle distance between two points specified by latitude and longitude (yes that is what my business is named after Haversine - a exotic trig function). Here is a technical reference with code I used.

    Calculate distance, bearing and more between Latitude/Longitude points
    http://www.movable-type.co.uk/scripts/latlong.html

    (2) I took a lot of shortcuts and packaged the demo in this fashion specifically to not involve any external services and for other reasons related to being able to maintain a working demo over time. A production implementation would probably have other requirements that could easily be accommodated.

    (3) Great Longitude movie:

    Longitude FULL MOV_E 2000 UK
    https://www.youtube.com/watch?v=LHvt48S9l4w
  • Dan,  thanks for the quick reply.  I'll look this over right away.  
    Jim
    P.S.  I liked the Alice Cooper video better.
  • Is there a way this code can be modified return the street address, city, state and zip code in addition to the Lat & Longitude?

    jQuery(document).ready(function getLocation()
      {
      if (navigator.geolocation)
        {
        navigator.geolocation.getCurrentPosition(showPosition);
        }
      
    var test = $.ajax({url: url,async:false,success: pushResult}).responseText;
       return false;
    });

    function showPosition(position){

          var editURL = "";
          editURL = "bkkzi23nv";
          editURL += "?act=API_EditRecord&key=" + QBU_recid;
          editURL += "&_fid_7=" + position.coords.latitude;
          editURL += "&_fid_8=" + position.coords.longitude;

          $.ajax({url: editURL,async:false});

          location.reload(true);
     }
  • > Is there a way this code can be modified return the street address, city, state and zip code in addition to the Lat & Longitude?

    You need to use a "reverse geocoding" service. Google has one. I geocoded QuickBase's HQ address and put the lat/lon into the reverse geocode service as follows:

    150 Cambridge Park Dr, Cambridge, MA 02140, USA


    42.3944341,-71.1461022


    Pastie Database
    https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&rid=490


    JSON Response
    http://pastie.org/10713624
  • The code will work but you are going to have to address some issues that are unique to working within QuickBase's mobile layout.  I know for instance that to get the image onload technique to work on mobile you have to use a slightly different module.js file to detect the appropriate URLs used with mobile.
  • CarlosCarlos's avatar
    CarlosCarlos
    Qrew Assistant Captain
    I guess for now i'll leave it at the full version. Can this be used to return a single value to the same record where the search was performed, instead of generating a list of results? I'm trying to replicate this but once the current location is obtained the key field of the closest store is brought to a field in the search. Sadly my JS skills are nowhere near what I need for this...
  • Yes it can. Sometimes I have to create the demo so that it would emphasize some feature to all users or to insure the demo will survive into the future without maintenance. I can't remember why I constructed it as it is but I am sure I had a good reason at the time.

    If you need specific help feel free to contact me off world using the information in my profile.