Inkey Solution Logo
banner

Blogs

Sort the PowerApps data using the GPS Location

, June 10, 2019 4956 Views

Let’s learn today to sort the data of PowerApps based on the current GPS location. In the below example, we are having Microsoft Dynamics CRM 365 as the database of the PowerApp.

This PowerApp was basically developed for one of our client requiring a mobile application that will be used by their Customer care department users(D365) who will go to their client’s location and get their problems solved.

In order to show the nearest addresses of their customers on the top of the list based on the current GPS Location, we created two new fields in their existing client database named “Latitude” and “Longitude”. These fields are having related Latitude and Longitude values based on the client’s address.

The Acos, Cos, Radians and Sin functions of the PowerApp along with the Location class can be used to sort the data based on the current GPS Location in the PowerApps as follows:

Note: In the below formula, ink_latitude and ink_longitude are the schema name of the above-said newly created fields having related Latitude and Longitude values based on the client’s address.

“Items” property value of the gallery:

//Addresses nearer to the current GPS location will be displayed on the top of the list
Sort(
  Clients,
  Acos(Cos(Radians(90 - ink_latitude)) * Cos(Radians(90 - Location.Latitude)) + 
  Sin(Radians(90 -  ink_latitude)) *      
  Sin(Radians(90 - Location.Latitude)) * 
  Cos(Radians(ink_longitude - Location.Longitude))) * 6371,
  Ascending
)

I hope this helps you!!


ATM Inspection PowerApp to ease ATM inspection and report generation process.
https://powerapps.microsoft.com/en-us/partner-showcase/inkey-solutions-atm-inspection/

Insert data into Many-to-Many relationship in Dynamics CRM very easily & quickly, using the Drag and drop listbox.
http://www.inkeysolutions.com/what-we-do/dynamicscrmaddons/drag-and-drop-listbox

Comply your Lead, Contact, and User entities of D365 CRM with GDPR compliance using the GDPR add-on.
https://www.inkeysolutions.com/microsoft-dynamics-365/dynamicscrmaddons/gdpr

Create a personal / system view in Dynamics CRM with all the fields on the form/s which you select for a particular entity using the View Creator.
http://www.inkeysolutions.com/what-we-do/dynamicscrmaddons/view-creator

mm

Inkey

INKEY is your solution partner.
Our focus is to deliver you in-time intelligent innovative solutions ("key") for the problems in hand. Maintaining a quality standard right from the inception of a project is our top most priority.

Our team of talented professionals will execute your projects with dedication and excellence. We take ownership and accountability for the effort that goes into meeting our client’s needs.

Years of experience and proven success of delivering innovative custom solutions.

More posts by

2 responses to “Sort the PowerApps data using the GPS Location”

  1. robert kuczma says:

    This looks great
    One question how did you do the distance calculation?

    Thanks

Leave a Reply

Your email address will not be published. Required fields are marked *

The maximum upload file size: 2 MB. You can upload: image, audio, video, document, spreadsheet, interactive, text, archive, code, other. Drop file here

Would you like to digitize your business and put it on the cloud?
Do you need clear, concise reports for your organization?