I have a table of CLIENTS and a table of CONTRACTORS, each one of them have Coordinates of their location. I have a formula that calculates the DISTANCE between each one.
How can i show in the dropdown list of CONTRACTORS in a form the ones that are closer to the CLIENT based on the distance?
I have a similar request but for some reason i’m struggling to bring up a dynamic list of Refs based on their distance (Low > High)
I’ve got two tables: Books, Bookstores.
Each contains a column called [LatLong].
Here’s my formula for that VC column that will live in the BOOKS table:
ORDERBY(
SELECT(
BOOKSTORES[Record_ID],
TRUE
),
DISTANCE(
INDEX(SELECT(BOOKS[LatLong],[Unique Book Record ID] = [_THISROW].[Unique Book Record ID]),1),
INDEX(SELECT(BOOKSTORES[LatLong],[Record_ID] = [_THIS].[Record_ID]),1)
)
)
I’m simply trying to get a list of BOOKSTORES that are closest to the given BOOK.
Sounds like an elementary formula but… i’m missing something.
I have exactly used your expression parameters. The error indicated that the [Record_ID] column does not exists. Check your column names and tablenames if they are relevant, associated and matching as well.
Hi @Steve> > Your expression works but the list of bookstores in simply in alphabetical order it seems.
With @Steve’s kind permission, a small touch to his expression might help:
ORDERBY(
BOOKSTORES[Record_ID],
DISTANCE(
[LatLong],
LOOKUP(
[_THISROW].[Unique Book Record ID],
"BOOKS",
"Unique Book Record ID",
"LatLong"
)
),
FALSE
)
The FALSE parameter at the end, sorts the list in ascending order. Provided you require descending order, change it to TRUE