<?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: Calculating the mean with attribute rules and getting the error: Failed to evaluate Arcade expression in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/calculating-the-mean-with-attribute-rules-and/m-p/1340798#M74323</link>
    <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/215600"&gt;@DanPatterson&lt;/a&gt;&amp;nbsp;Thanks for your input! Your input brought me to the solution.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Now, the script works for me - I've just needed to specify that my output needs to be a number:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;var fsSM = FeatureSetByName($datastore, "Analysepunkte_ExportFeatures", ["FB_Breite"]);&lt;BR /&gt;var zust = Intersects(fsSM, $feature);&lt;BR /&gt;var cnt = Count(zust)&lt;BR /&gt;var expr = ''&lt;/P&gt;&lt;P&gt;if (cnt == 0)&lt;BR /&gt;{expr = '0'}&lt;BR /&gt;else {&lt;BR /&gt;expr = Number(Mean(zust, "FB_Breite"))&lt;BR /&gt;}&lt;BR /&gt;return expr&lt;/P&gt;</description>
    <pubDate>Tue, 24 Oct 2023 08:30:39 GMT</pubDate>
    <dc:creator>NadjaHertel</dc:creator>
    <dc:date>2023-10-24T08:30:39Z</dc:date>
    <item>
      <title>Calculating the mean with attribute rules and getting the error: Failed to evaluate Arcade expression</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/calculating-the-mean-with-attribute-rules-and/m-p/1339456#M74147</link>
      <description>&lt;P&gt;Hi all,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have two layers. The first layer, contains streets as a line feature and in it, I make the attribute rules to extend the dataset. In my second layer, called "Analysepunkte_ExportFeatures" and that contains points that lie on those lines from the first layer. Each of the points contains a measurement value, the road width. Now I want to intersect the layers, and to calculate the mean of these points for each line.&amp;nbsp;&lt;BR /&gt;When I am trying to update my attribute table in a test field with the field calculator, I get the error:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;ERROR 160912:&lt;SPAN class=""&gt; Failed to evaluate Arcade expression.&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;If I run everything through without this one attribute rule, then everything works again.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my script of the attribute rule:&lt;/P&gt;&lt;P&gt;var fsSM = FeatureSetByName($datastore, "Analysepunkte_ExportFeatures", ["FB_Breite"]);&lt;BR /&gt;var zust = Intersects(fsSM, $feature);&lt;BR /&gt;var cnt = Count(zust)&lt;BR /&gt;var expr = ''&lt;/P&gt;&lt;P&gt;If (cnt == 0)&lt;BR /&gt;{expr = '0'}&lt;BR /&gt;else {&lt;BR /&gt;expr = Mean(zust)&lt;BR /&gt;}&lt;BR /&gt;return expr&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I solve this?&lt;/P&gt;&lt;P&gt;Thanks for your help! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Oct 2023 07:23:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/calculating-the-mean-with-attribute-rules-and/m-p/1339456#M74147</guid>
      <dc:creator>NadjaHertel</dc:creator>
      <dc:date>2023-10-19T07:23:17Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating the mean with attribute rules and getting the error: Failed to evaluate Arcade expression</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/calculating-the-mean-with-attribute-rules-and/m-p/1339524#M74159</link>
      <description>&lt;P&gt;wouldn't you have to convert&amp;nbsp;&lt;SPAN&gt;expr = Mean(zust) to text to match the output case of when cnt == 0 ?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Oct 2023 12:39:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/calculating-the-mean-with-attribute-rules-and/m-p/1339524#M74159</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2023-10-19T12:39:46Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating the mean with attribute rules and getting the error: Failed to evaluate Arcade expression</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/calculating-the-mean-with-attribute-rules-and/m-p/1340798#M74323</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/215600"&gt;@DanPatterson&lt;/a&gt;&amp;nbsp;Thanks for your input! Your input brought me to the solution.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Now, the script works for me - I've just needed to specify that my output needs to be a number:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;var fsSM = FeatureSetByName($datastore, "Analysepunkte_ExportFeatures", ["FB_Breite"]);&lt;BR /&gt;var zust = Intersects(fsSM, $feature);&lt;BR /&gt;var cnt = Count(zust)&lt;BR /&gt;var expr = ''&lt;/P&gt;&lt;P&gt;if (cnt == 0)&lt;BR /&gt;{expr = '0'}&lt;BR /&gt;else {&lt;BR /&gt;expr = Number(Mean(zust, "FB_Breite"))&lt;BR /&gt;}&lt;BR /&gt;return expr&lt;/P&gt;</description>
      <pubDate>Tue, 24 Oct 2023 08:30:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/calculating-the-mean-with-attribute-rules-and/m-p/1340798#M74323</guid>
      <dc:creator>NadjaHertel</dc:creator>
      <dc:date>2023-10-24T08:30:39Z</dc:date>
    </item>
  </channel>
</rss>

