Sorting List of Geographic Addresses Using Separate Text List

I have a custom state geographic address list of waypoints and a separate custom state text list of numeric values (which is meant to represent the sort order).

Geographic addresses:

  • Boston
  • Miami
  • New York

Sort Order (Text):

  • 0
  • 2
  • 1

Final Desired Result (sorted):

  • Boston (0)
  • New York (1)
  • Miami (2)

How would I achieve the above sorting/display?

Get all options :sort by sort order

I don’t think that would work here. I’m talking about sorting one custom state, based on another separate custom state’s values. Both custom states would have the same length and number of values.

Questions:

  1. Why are the addresses in a custom state list?
  2. What is the value you want to sort the addresses by?
  3. Where do these addresses originally come from, your DB or an API call?

I’m building a delivery route optimization feature. An end user can add a list of addresses (waypoints) that they’d like to optimize the route for. So the addresses are not necessarily stored in the DB. Then I run the Google Routes API which returns the waypoint sort order. Ultimately, I’d like to sort the address custom state, by the sort order list returned by the API.

This topic was automatically closed after 70 days. New replies are no longer allowed.