Hi so i am working with a logistics company that want to pass multiple locations into a system where it will then calculate the distance between those locations.
Here is what the page could look like: (blurred out parts are the locations)
Now here is my problem. I know that there is a distance between column in glide and I know that I can have multiple of these and then just calculate them all together with a formula.
Do any of you know of a better way to do this. I am also a little bit experienced with api calls.
So you’re basically looking to calculate the total distance in a single step. And I guess the challenge might be that there could be an indeterminant number of intermediate stops, yes?
I think my approach to this would be to use a Helper Table to arrange the route stops into rows, use a single column to calculate the distance between each stop (1st to 2nd row, 2nd to 3rd row, etc), and then use a rollup to calculate the total.
That was my approach before posting in the community. I am wondering if its possible to send these locations as an array into airtable where I can run a script to calculate the distances.
Oh yes, that what i was working on. But I would have preferred if I could do it in glide as doing things in airtable is really slow. I wish we could pass arrays into the js column
The locations are set as an array and then the JS looks for the first and last entries in the array that sets them as Origin and Destination, with the rest being set as Waypoints.
var origin = locationsArray[0];
var destination = locationsArray[locationsArray.length - 1];
var waypoints = [];
for (var i = 1; i < locationsArray.length - 1; i++) {
waypoints.push({location: locationsArray[i]});
}