I have a Rg of 6 places, sorted by order (field type number, 1 to 6). so in my RG :
place xy : RG item 1 (order field =1)
place yz : RG item 2 (order field = 2)
etc etc
I send to Google direction API all addresses from this RG (field Geographical place).
The API response gives an optimized order for the route like :
2,5,3,6,4,1 (where number are items # of my RG)
I need to re-order my RG, probably by making a “change a list of things” editing the order field to match the order sent by the api.
and… blank page in my head hope I will find someone with a brain more efficient than mine on this !
thanks a lot
I don’t know exactly how your WF are, but I suggest this way:
A) Do the API call and store the result into a state.
B) Make change to a list. In the Order field: State API Response: filtered (Address = This item address): first item’s order (or any other way to filter the result of the API with this item field to match
I’ve made some test using another request. So basically, you submit all the waypoint in your request and in the order array, this will let you know in which order they have been set. So you can use the current cell index to find the correct order in this fields
So for exemple, if you submit in this order: waypointA|waypointB|waypointC|waypointD
Google will tell you for each of them the order they have been optimized
Exemple [ 2, 3, 0, 1 ]
This mean waypointC is the first, D the second, A the third and 3 the last.
So if you use Make change to a list “address” you can use the initial order (current cell or order field initialy set) and use …'s waypoint_order:item #(current cell index or This item order field)