Hi all
I would like to get the nearest clinic for each record by using SP list
results will be coming from a collection
how would I combine data source + collection to display results in one gallery
My collection code:
ClearCollect(ClnicRoute2, {Name:"Wapping & Bigland Children’s Centre", Address:"E1 2JP"});
Collect(ClnicRoute2, {Name:"T1", Address:"RAN1 0ND"});
Collect(ClnicRoute2, {Name:"T2", Address:"RAN1 2EN"});
Collect(ClnicRoute2, {Name:"T3", Address:"RAN1 0AF"});
Collect(ClnicRoute2, {Name:"T4", Address:"RAN1 3BX"});
Collect(ClnicRoute2, {Name:"T5", Address:"RAN1 6AW"});
Collect(ClnicRoute2, {Name:"T6", Address:"RAN1 8AP"});
Collect(ClnicRoute2, {Name:"T7", Address:"RAN1 0NU"});
Collect(ClnicRoute2, {Name:"T8", Address:"RAN1 9DL"});
Collect(ClnicRoute2, {Name:"T9", Address:"RAN1 8JH"});
Collect(ClnicRoute2, {Name:"T10", Address:"RAN1 3LL"});
Collect(ClnicRoute2, {Name:"T11", Address:"RAN1 5DS"});
Collect(ClnicRoute2, {Name:"T12", Address:"RAN1 2RU"});
Collect(ClnicRoute2, {Name:"T13", Address:"RAN1 0SN"});
Collect(ClnicRoute2, {Name:"T14", Address:"RAN1 4GY"});
Collect(ClnicRoute2, {Name:"T15", Address:"RAN1 5QT"});
Collect(ClnicRoute2, {Name:"T16", Address:"RAN1 8HQ"});
ClearCollect(
ClnicDistance2,
AddColumns(
ClnicRoute2,
"DistanceToClnic",
BingMaps.GetRouteV3("Walking", ThisItem.Postcode2, Address, {distanceUnit:"Mile"}).travelDistance
)
);
// Sort the collection by "DistanceToClnic" in ascending order
ClearCollect(SortedClnicDistance, SortByColumns(ClnicDistance, "DistanceToClnic", Ascending));
// Get the clinic with the shortest distance
ClearCollect(ShortestDistanceClinic, First(SortedClnicDistance));
Gallery:

I hope I made sense
Thank you all