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
© All Rights Reserved. Inkey IT Solutions Pvt. Ltd. 2024
This looks great
One question how did you do the distance calculation?
Thanks
Hello Robert,
We used a formula to calculate the distance. You will find it in the shared code itself.