Help to sort listview

Good Morning,

If anyone can help me…

I am making an application where the following steps take place:

1º- The person places the zip code in “Screen 1” and I capture the latitude and longitude (API CEPaberto) (the accuracy of the address is not the most relevant at the moment)

2º- Then the grid opens with the companies in the locality (print attached);

(Deephost custom_listview extension)

3º- Then the person chooses the company and opens details of the company, available products, distance and the value of the “purchase” (attached print).

Please, I need help with the following questions:

1º- I would like the distance to appear on the grid instead of the phone (but I only managed to calculate the distance, after choosing a company on the grid)

2º- I would like companies to appear on the grid sorted by distance (the closest ones at the top), and only companies to appear up to 5km away.

All company information is in Airtable (Name, products, latitude, longitude …)

Image of the listview and calculation blocks:

Sorry the english.
Posted too in our group in Facebook. See There. :+1: :grinning:
This is the solution to sort your list.