<?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 Arcade Calculate Field -- Error Help Please in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-calculate-field-error-help-please/m-p/1051161#M40208</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I'm using ArcGIS Pro to calculate total percent of parcels in a hazard zone. For this I used the tabulate intersection tool, and successfully was able to get a pivot table that shows each parcel in a city limit that overlaps with a certain hazard. Right now, I am working with flood data, so my pivot table's has A, AE, VE, and X flood zone fields. Since there are over 3,000 parcels, I don't want to calculate what parcel is in what flood zone manually, so I created a new field "High_Zone". I was going to use the stats with city and flood zone as my axes, but the graph repeats parcels because I did not specify any overlap classification.&lt;/P&gt;&lt;P&gt;The classification I need to use is: if a parcel is 45% or more in a zone, then I will say that whole parcel is in that zone. But, I want to make sure that the parcels that are 45% or more in zone X to be prioritized before any other zone since it is more dangerous. So, I tried doing this code block in my High_Zone field, but am running into errors. I am using Arcade (but I did try using python but also ran into issues -- got the error on line 1, identifier expected, but I before I redid my code I kept getting open parenthesis expected).&amp;nbsp;&lt;/P&gt;&lt;P&gt;For more clarity:&amp;nbsp;&lt;/P&gt;&lt;P&gt;My pivot table looks like this:&lt;/P&gt;&lt;P&gt;I want High_Zone field to output a flood zone with more than 45% (I do use 44.5% in my code because I think that range is still very close enough to classify as primary hazard in that parcel)&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="8.333333333333334%"&gt;Parcel ID&lt;/TD&gt;&lt;TD width="8.333333333333334%" height="25px"&gt;City&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;A&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;AE&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;VE&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;X&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;High_Zone&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="8.333333333333334%"&gt;123456&lt;/TD&gt;&lt;TD width="8.333333333333334%" height="201px"&gt;XXXX&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="201px"&gt;null&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="201px"&gt;51.2&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="201px"&gt;null&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="201px"&gt;44.5&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="201px"&gt;X (although AE if higher %. because I am going for ~45% I want to include 44.5% of X, the more dangerous hazard)&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="8.333333333333334%"&gt;78910&lt;/TD&gt;&lt;TD width="8.333333333333334%" height="25px"&gt;AAAA&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;73&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;10&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;null&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;null&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;A&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;if ($feature.A &amp;gt;= 44.5) {
 return "A"
} if ($feature.AE &amp;gt;= 44.5) {
 return "AE"
} if ($feature.VE &amp;gt;= 44.5) {
 return "VE"
} if ($feature.X &amp;gt;= 44.5) {
 return "X"
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;if ($feature.A &amp;gt;= 44.5) {
 return "A";
}
if ($feature.AE &amp;gt;= 44.5) {
 return "AE";
}
if ($feature.VE &amp;gt;= 44.5) {
 return "VE";
}
if ($feature.X &amp;gt;= 44.5) {
 return "X"
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Edit: I just tried the second code and I got no errors, but aside from one AE, and all A, all outputs are null&lt;/P&gt;</description>
    <pubDate>Sun, 25 Apr 2021 22:08:28 GMT</pubDate>
    <dc:creator>worro</dc:creator>
    <dc:date>2021-04-25T22:08:28Z</dc:date>
    <item>
      <title>Arcade Calculate Field -- Error Help Please</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-calculate-field-error-help-please/m-p/1051161#M40208</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I'm using ArcGIS Pro to calculate total percent of parcels in a hazard zone. For this I used the tabulate intersection tool, and successfully was able to get a pivot table that shows each parcel in a city limit that overlaps with a certain hazard. Right now, I am working with flood data, so my pivot table's has A, AE, VE, and X flood zone fields. Since there are over 3,000 parcels, I don't want to calculate what parcel is in what flood zone manually, so I created a new field "High_Zone". I was going to use the stats with city and flood zone as my axes, but the graph repeats parcels because I did not specify any overlap classification.&lt;/P&gt;&lt;P&gt;The classification I need to use is: if a parcel is 45% or more in a zone, then I will say that whole parcel is in that zone. But, I want to make sure that the parcels that are 45% or more in zone X to be prioritized before any other zone since it is more dangerous. So, I tried doing this code block in my High_Zone field, but am running into errors. I am using Arcade (but I did try using python but also ran into issues -- got the error on line 1, identifier expected, but I before I redid my code I kept getting open parenthesis expected).&amp;nbsp;&lt;/P&gt;&lt;P&gt;For more clarity:&amp;nbsp;&lt;/P&gt;&lt;P&gt;My pivot table looks like this:&lt;/P&gt;&lt;P&gt;I want High_Zone field to output a flood zone with more than 45% (I do use 44.5% in my code because I think that range is still very close enough to classify as primary hazard in that parcel)&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="8.333333333333334%"&gt;Parcel ID&lt;/TD&gt;&lt;TD width="8.333333333333334%" height="25px"&gt;City&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;A&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;AE&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;VE&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;X&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;High_Zone&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="8.333333333333334%"&gt;123456&lt;/TD&gt;&lt;TD width="8.333333333333334%" height="201px"&gt;XXXX&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="201px"&gt;null&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="201px"&gt;51.2&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="201px"&gt;null&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="201px"&gt;44.5&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="201px"&gt;X (although AE if higher %. because I am going for ~45% I want to include 44.5% of X, the more dangerous hazard)&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="8.333333333333334%"&gt;78910&lt;/TD&gt;&lt;TD width="8.333333333333334%" height="25px"&gt;AAAA&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;73&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;10&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;null&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;null&lt;/TD&gt;&lt;TD width="16.666666666666668%" height="25px"&gt;A&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;if ($feature.A &amp;gt;= 44.5) {
 return "A"
} if ($feature.AE &amp;gt;= 44.5) {
 return "AE"
} if ($feature.VE &amp;gt;= 44.5) {
 return "VE"
} if ($feature.X &amp;gt;= 44.5) {
 return "X"
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;if ($feature.A &amp;gt;= 44.5) {
 return "A";
}
if ($feature.AE &amp;gt;= 44.5) {
 return "AE";
}
if ($feature.VE &amp;gt;= 44.5) {
 return "VE";
}
if ($feature.X &amp;gt;= 44.5) {
 return "X"
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Edit: I just tried the second code and I got no errors, but aside from one AE, and all A, all outputs are null&lt;/P&gt;</description>
      <pubDate>Sun, 25 Apr 2021 22:08:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-calculate-field-error-help-please/m-p/1051161#M40208</guid>
      <dc:creator>worro</dc:creator>
      <dc:date>2021-04-25T22:08:28Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Calculate Field -- Error Help Please</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-calculate-field-error-help-please/m-p/1051286#M40229</link>
      <description>&lt;P&gt;With multiple conditions, you should include &lt;STRONG&gt;else&lt;/STRONG&gt; in your code to indicate the order in which things are to evaluate. As you state, you want zone X to be prioritized, so you list it first in the series of conditions.&lt;/P&gt;&lt;P&gt;By using "else if" for the following condition, it will evaluate only if the preceding condition is False, that is, X is &lt;STRONG&gt;not&lt;/STRONG&gt; greater than the threshold.&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;var f = $feature
var t = 44.5

if (f.X &amp;gt;= t) {
    return 'X'
} else if (f.A &amp;gt;= t) {
    return 'A'
} else if (f.AE &amp;gt;= t) {
    return 'AE'
} else if (f.VE &amp;gt;= t) {
    return 'VE'
} else {
    return 'No High Zone'
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, by including a final 'else', we give the code an output for when all conditions evaluate as False.&lt;/P&gt;&lt;P&gt;Could you clarify, though: if two zones are above 44.5%, would you want them &lt;EM&gt;both &lt;/EM&gt;in the output field? That would require a different bit of code than this.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Apr 2021 13:20:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-calculate-field-error-help-please/m-p/1051286#M40229</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2021-04-26T13:20:04Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Calculate Field -- Error Help Please</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-calculate-field-error-help-please/m-p/1051381#M40245</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for helping me! To answer your question, I would want only one output, prioritized from highest to lowest in risk, but with flood zones in general not sure which is worse. For other hazards I am working on, I am just scaling downwards in class. For example, with seismic I would go from highest shaking intensity to lowest, top-down, in code. To clarify here's what I wrote in my code block for flood:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;if ($feature.X &amp;gt;= 44.5) {
 return "X"
}
if ($feature.A &amp;gt;= 44.5) {
 return "A";
}
if ($feature.AE &amp;gt;= 44.5) {
 return "AE";
}
if ($feature.VE &amp;gt;= 44.5) {
 return "VE";
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;From what I saw, the output looked correct, are there potential problems with my code? I planned on using this general format for all other hazards as well.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Apr 2021 16:30:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-calculate-field-error-help-please/m-p/1051381#M40245</guid>
      <dc:creator>worro</dc:creator>
      <dc:date>2021-04-26T16:30:54Z</dc:date>
    </item>
  </channel>
</rss>

