AnsweredAssumed Answered

Choose the Shortest Distance

Question asked by ben_miller246102 Employee on Nov 15, 2017
Latest reply on Nov 16, 2017 by ben_miller246102

I am choosing between multiple shipping locations which is the shortest distance.  I have the process running the lines through a google distance api and appending the distance (in meters) to the different line options.  So what I have is a bunch of one line files that are product, country, shiptozip, site, shipfromzip, distance.  I was going to sort the lines by distance, then drop the duplicates based on the right values and then run them into a document cache, and pull the site from the cache later on in the process.  The problem with my plan is that I cannot figure out how to sort the files by the distance.  I think the problem is that the script I am using How to Sort a group of Documents using Groovy  is not doing a mathematical sort.  


So I need to either figure out how to do a mathematical sort, or maybe someone can point out a simpler method that I hadn't thought of.  I can think of some ways to do it with dynamic process properties and scripting, but that sounds like a mess and I'd prefer to avoid that.