<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Multiple Routes in RouteTask in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/multiple-routes-in-routetask/m-p/90944#M8295</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I have a route task that is calculating multiple routes simultaneously.&amp;nbsp;&amp;nbsp; When the user clicks on a map, a stop is added and draws different routes for up to seven different locations.&amp;nbsp; I have assigned every stop a route name and each route is drawing properly to the appropriate stops.&amp;nbsp; I need to return the total length of each individual route as a variable for input into a function and was wondering what would be the best way of going about this.&amp;nbsp; I can successfully alert box the lengths of each route by using: var routeInfo = solveResult.routeResults[0].directions.totalLength; alert(JSON.stringify(routeInfo)); However, the order that each alert message displays starts with the shortest distance routes first.&amp;nbsp; How do I need to go about identifying which distance is associated with each route?&amp;nbsp; Thanks in advance.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Have you consider to use the routeName property of each RouteResult instance?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 23 Jan 2014 23:49:09 GMT</pubDate>
    <dc:creator>RobertoPepato</dc:creator>
    <dc:date>2014-01-23T23:49:09Z</dc:date>
    <item>
      <title>Multiple Routes in RouteTask</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/multiple-routes-in-routetask/m-p/90943#M8294</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have a route task that is calculating multiple routes simultaneously.&amp;nbsp;&amp;nbsp; When the user clicks on a map, a stop is added and draws different routes for up to seven different locations.&amp;nbsp; I have assigned every stop a route name and each route is drawing properly to the appropriate stops.&amp;nbsp; I need to return the total length of each individual route as a variable for input into a function and was wondering what would be the best way of going about this.&amp;nbsp; I can successfully alert box the lengths of each route by using: var routeInfo = solveResult.routeResults[0].directions.totalLength; alert(JSON.stringify(routeInfo)); However, the order that each alert message displays starts with the shortest distance routes first.&amp;nbsp; How do I need to go about identifying which distance is associated with each route?&amp;nbsp; Thanks in advance.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Jan 2014 22:56:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/multiple-routes-in-routetask/m-p/90943#M8294</guid>
      <dc:creator>WesleyAskew</dc:creator>
      <dc:date>2014-01-23T22:56:58Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple Routes in RouteTask</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/multiple-routes-in-routetask/m-p/90944#M8295</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I have a route task that is calculating multiple routes simultaneously.&amp;nbsp;&amp;nbsp; When the user clicks on a map, a stop is added and draws different routes for up to seven different locations.&amp;nbsp; I have assigned every stop a route name and each route is drawing properly to the appropriate stops.&amp;nbsp; I need to return the total length of each individual route as a variable for input into a function and was wondering what would be the best way of going about this.&amp;nbsp; I can successfully alert box the lengths of each route by using: var routeInfo = solveResult.routeResults[0].directions.totalLength; alert(JSON.stringify(routeInfo)); However, the order that each alert message displays starts with the shortest distance routes first.&amp;nbsp; How do I need to go about identifying which distance is associated with each route?&amp;nbsp; Thanks in advance.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Have you consider to use the routeName property of each RouteResult instance?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Jan 2014 23:49:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/multiple-routes-in-routetask/m-p/90944#M8295</guid>
      <dc:creator>RobertoPepato</dc:creator>
      <dc:date>2014-01-23T23:49:09Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple Routes in RouteTask</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/multiple-routes-in-routetask/m-p/90945#M8296</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Have you consider to use the routeName property of each RouteResult instance?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for your response.&amp;nbsp; Yes, I have tried to use this property, however, I cannot seem to get the properties associated with each individual route by name.&amp;nbsp; I only specify the routeName value for the stops, and am not really sure how this associates with each route segment.&amp;nbsp; Each route is solved using the following:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;routeTask.solve(routeParams);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;map.graphics.add(solveResult.routeResults[0].route.setSymbol(routeSymbol));&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I can also display the route name and distance in the same alert box using:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;var routeLength = solveResult.routeResults[0].directions.totalLength;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;var routeName =&amp;nbsp; solveResult.routeResults[0].routeName;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;var routeNameLength = routeName +" "+routeLength;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Do you have any suggestions on how to correspond the name of each route to the length as far as returning a variable is concerned?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Jan 2014 00:10:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/multiple-routes-in-routetask/m-p/90945#M8296</guid>
      <dc:creator>WesleyAskew</dc:creator>
      <dc:date>2014-01-24T00:10:00Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple Routes in RouteTask</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/multiple-routes-in-routetask/m-p/90946#M8297</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Thanks for your response.&amp;nbsp; Yes, I have tried to use this property, however, I cannot seem to get the properties associated with each individual route by name.&amp;nbsp; I only specify the routeName value for the stops, and am not really sure how this associates with each route segment.&amp;nbsp; Each route is solved using the following:&lt;BR /&gt;&lt;BR /&gt;routeTask.solve(routeParams);&lt;BR /&gt;map.graphics.add(solveResult.routeResults[0].route.setSymbol(routeSymbol));&lt;BR /&gt;&lt;BR /&gt;I can also display the route name and distance in the same alert box using:&lt;BR /&gt;var routeLength = solveResult.routeResults[0].directions.totalLength;&lt;BR /&gt;var routeName =&amp;nbsp; solveResult.routeResults[0].routeName;&lt;BR /&gt;var routeNameLength = routeName +" "+routeLength;&lt;BR /&gt;&lt;BR /&gt;Do you have any suggestions on how to correspond the name of each route to the length as far as returning a variable is concerned?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can use a Javascript object in a hastable-like manner. For exemple, inside a loop for your routeResults you could use:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;routes[solveResult.routeResults[index].routeName] = solveResult.routeResults[0].directions.totalLength&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In the previous sample, index is the for loop indexer and you need to previously declare de routes object (before the loop):&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;var routes = {};&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;After that, you can get the total length of a specific route by using its name as an indexer for the routes object:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;var distance = routes["your_route_name"];&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Jan 2014 08:41:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/multiple-routes-in-routetask/m-p/90946#M8297</guid>
      <dc:creator>RobertoPepato</dc:creator>
      <dc:date>2014-01-24T08:41:09Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple Routes in RouteTask</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/multiple-routes-in-routetask/m-p/90947#M8298</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;You can use a Javascript object in a hastable-like manner. For exemple, inside a loop for your routeResults you could use:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;routes[solveResult.routeResults[index].routeName] = solveResult.routeResults[0].directions.totalLength&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;In the previous sample, index is the for loop indexer and you need to previously declare de routes object (before the loop):&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;var routes = {};&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;After that, you can get the total length of a specific route by using its name as an indexer for the routes object:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;var distance = routes["your_route_name"];&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This method worked like a charm.&amp;nbsp; Thanks alot for your help!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Jan 2014 19:00:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/multiple-routes-in-routetask/m-p/90947#M8298</guid>
      <dc:creator>WesleyAskew</dc:creator>
      <dc:date>2014-01-24T19:00:51Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple Routes in RouteTask</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/multiple-routes-in-routetask/m-p/90948#M8299</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;This method worked like a charm.&amp;nbsp; Thanks alot for your help!&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Good to hear Wesley. It would be nice if you could please mark the reply that solved your problem as the correct solution and close the post so other people on the forum can benefit from the solution.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Jan 2014 22:25:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/multiple-routes-in-routetask/m-p/90948#M8299</guid>
      <dc:creator>RobertoPepato</dc:creator>
      <dc:date>2014-01-24T22:25:28Z</dc:date>
    </item>
  </channel>
</rss>

