<?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: Network dataset - Costs: How to create a evaluator expression referencing a field of the feature class in ArcGIS Network Analyst Questions</title>
    <link>https://community.esri.com/t5/arcgis-network-analyst-questions/network-dataset-costs-how-to-create-a-evaluator/m-p/1246860#M8167</link>
    <description>&lt;P&gt;For field script evaluators like these, all the processing is done when you call Build Network.&amp;nbsp; The values are stored in the network dataset and are just looked up at solve time, so there shouldn't be any performance difference between Python and VBScript evaluators.&amp;nbsp; If there is, that performance difference would be incurred at build time, not at solve time.&lt;/P&gt;&lt;P&gt;However, I believe the performance difference is mostly historical at this point.&amp;nbsp; There certainly was some difference back in the ArcMap days, but I think that is either gone or significantly less now, although I don't have specific data to back that up.&lt;/P&gt;&lt;P&gt;Note that element script evaluators are different from field script evaluators.&amp;nbsp; Their code is run at solve time, so the solve may be slower, depending on the efficiency of the code itself.&amp;nbsp; This does not apply to your situation.&lt;/P&gt;</description>
    <pubDate>Tue, 10 Jan 2023 16:37:09 GMT</pubDate>
    <dc:creator>MelindaMorang</dc:creator>
    <dc:date>2023-01-10T16:37:09Z</dc:date>
    <item>
      <title>Network dataset - Costs: How to create a evaluator expression referencing a field of the feature class</title>
      <link>https://community.esri.com/t5/arcgis-network-analyst-questions/network-dataset-costs-how-to-create-a-evaluator/m-p/1246263#M8163</link>
      <description>&lt;P&gt;Hello! I have a network dataset and I want to create a evaluator expression in "Costs" referencing a field of the feature class. Can somebody help me, please?&lt;/P&gt;&lt;P&gt;These are my current costs of the ND.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ConnieSu_0-1673091289440.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/59923i1BC3169B6488BEAB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ConnieSu_0-1673091289440.png" alt="ConnieSu_0-1673091289440.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;For the edges feature class "PNL2017_Rodovias_Completo", I would like to create a expression like this:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;if(TYPENO=="7001"):
    return 0.069001*[Shape]
else:
    return 0.039429*[Shape]
&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;And for the junctions feature class "PNL2017_Suporte_Pontos_Rodo", I would like something like this:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;if(TYPENO=="7001"):
    return 17.1361
else:
    return 35.18
&lt;/LI-CODE&gt;&lt;P&gt;Could you please help me?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks and regards!&lt;/P&gt;</description>
      <pubDate>Sat, 07 Jan 2023 11:44:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-network-analyst-questions/network-dataset-costs-how-to-create-a-evaluator/m-p/1246263#M8163</guid>
      <dc:creator>ConnieSu</dc:creator>
      <dc:date>2023-01-07T11:44:22Z</dc:date>
    </item>
    <item>
      <title>Re: Network dataset - Costs: How to create a evaluator expression referencing a field of the feature class</title>
      <link>https://community.esri.com/t5/arcgis-network-analyst-questions/network-dataset-costs-how-to-create-a-evaluator/m-p/1246510#M8164</link>
      <description>&lt;P&gt;You can do this with a field script evaluator.&amp;nbsp; Those evaluator dialogs are a little hard to use, though, so I can see why you need a hint!&lt;/P&gt;&lt;P&gt;First, for the evaluator you want to update, double click in the Value column until you see the box on the far right with the green X.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MelindaMorang_0-1673281373907.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/59979i4A4A0C26FCC51ED1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MelindaMorang_0-1673281373907.png" alt="MelindaMorang_0-1673281373907.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;You'll get a pop-up box where you can create an expression for the field script evaluator.&amp;nbsp; You will want something like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MelindaMorang_1-1673282368913.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/59983i779ED763189A4D00/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MelindaMorang_1-1673282368913.png" alt="MelindaMorang_1-1673282368913.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Basically the Result box calls a custom-defined function called get_value() and passes the TYPENO and Shape field values to it.&amp;nbsp; The ! surrounding the field names is what's used for Python evaluators.&amp;nbsp; I'm using Python instead of VBScript because it's easier to code in (for me), and VBScript evaluators will be deprecated soon.&lt;/P&gt;&lt;P&gt;Here's the code for the codeblock:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def get_value(typeno, shape):
    if typeno == "7001":
        return 0.069001 * shape
    else:
        return 0.039429 * shape&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your expression for the junctions source will be very similar, but you won't need to pass the Shape field into the function.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jan 2023 16:42:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-network-analyst-questions/network-dataset-costs-how-to-create-a-evaluator/m-p/1246510#M8164</guid>
      <dc:creator>MelindaMorang</dc:creator>
      <dc:date>2023-01-09T16:42:18Z</dc:date>
    </item>
    <item>
      <title>Re: Network dataset - Costs: How to create a evaluator expression referencing a field of the feature class</title>
      <link>https://community.esri.com/t5/arcgis-network-analyst-questions/network-dataset-costs-how-to-create-a-evaluator/m-p/1246712#M8166</link>
      <description>&lt;P&gt;Thanks for your reply Melinda! It worked!&lt;/P&gt;&lt;P&gt;I've read that VBScript processes faster than Python. Will Python be faster when VBScript is deprecated?&lt;/P&gt;&lt;P&gt;Thanks and regards!&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2023 11:23:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-network-analyst-questions/network-dataset-costs-how-to-create-a-evaluator/m-p/1246712#M8166</guid>
      <dc:creator>ConnieSu</dc:creator>
      <dc:date>2023-01-10T11:23:21Z</dc:date>
    </item>
    <item>
      <title>Re: Network dataset - Costs: How to create a evaluator expression referencing a field of the feature class</title>
      <link>https://community.esri.com/t5/arcgis-network-analyst-questions/network-dataset-costs-how-to-create-a-evaluator/m-p/1246860#M8167</link>
      <description>&lt;P&gt;For field script evaluators like these, all the processing is done when you call Build Network.&amp;nbsp; The values are stored in the network dataset and are just looked up at solve time, so there shouldn't be any performance difference between Python and VBScript evaluators.&amp;nbsp; If there is, that performance difference would be incurred at build time, not at solve time.&lt;/P&gt;&lt;P&gt;However, I believe the performance difference is mostly historical at this point.&amp;nbsp; There certainly was some difference back in the ArcMap days, but I think that is either gone or significantly less now, although I don't have specific data to back that up.&lt;/P&gt;&lt;P&gt;Note that element script evaluators are different from field script evaluators.&amp;nbsp; Their code is run at solve time, so the solve may be slower, depending on the efficiency of the code itself.&amp;nbsp; This does not apply to your situation.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2023 16:37:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-network-analyst-questions/network-dataset-costs-how-to-create-a-evaluator/m-p/1246860#M8167</guid>
      <dc:creator>MelindaMorang</dc:creator>
      <dc:date>2023-01-10T16:37:09Z</dc:date>
    </item>
  </channel>
</rss>

