<?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: Arcade help with calculated value in Field Maps in ArcGIS Field Maps Questions</title>
    <link>https://community.esri.com/t5/arcgis-field-maps-questions/arcade-help-with-calculated-value-in-field-maps/m-p/1598955#M10601</link>
    <description>&lt;P&gt;Here is an example. For this, I start with single conditions and return the function based on that. If it doesn't meet the logic of the if statement it passes to the next logic. Finally if all non-applicable or non-habitable conditions are passed, it return habitable.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;//handles non-residential buildings and returns not applicable
if($feature.BuildingType != 'Residential'){
    return 'Not Applicable'
};

//if it is "Residential" will check for damage and return val
if($feature.Damaga == 'Severe' || $feature.Damage == 'Destroyed'){
    return 'Not Habitable'
};

//if the building is residential and the damage is not severe or destroyed will return this vallue
return 'Habitable'
&lt;/LI-CODE&gt;</description>
    <pubDate>Tue, 25 Mar 2025 13:50:54 GMT</pubDate>
    <dc:creator>AustinAverill</dc:creator>
    <dc:date>2025-03-25T13:50:54Z</dc:date>
    <item>
      <title>Arcade help with calculated value in Field Maps</title>
      <link>https://community.esri.com/t5/arcgis-field-maps-questions/arcade-help-with-calculated-value-in-field-maps/m-p/1598947#M10600</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I am looking for some help with a calculated value in Field Maps. My very limited Arcade is letting me down and any help would be appreciated.&lt;/P&gt;&lt;P&gt;Background&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Using Field Maps for Damage Assessment&lt;/LI&gt;&lt;LI&gt;Feature is&amp;nbsp;&lt;STRONG&gt;DamageAssessment&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;Need to calculate &lt;STRONG&gt;IsHabitable&lt;/STRONG&gt;&amp;nbsp;field - values are &lt;STRONG&gt;Habitable&lt;/STRONG&gt;, &lt;STRONG&gt;Not Habitable&lt;/STRONG&gt;, and &lt;STRONG&gt;Not Applicable&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;Other factors are &lt;STRONG&gt;BuildingType&lt;/STRONG&gt; and &lt;STRONG&gt;Damage&lt;/STRONG&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Form order sees the following:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Select&amp;nbsp;&lt;STRONG&gt;BuildingType&lt;/STRONG&gt;&lt;UL&gt;&lt;LI&gt;&amp;nbsp;options are &lt;STRONG&gt;Residential&lt;/STRONG&gt; and a range of other values&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;Select &lt;STRONG&gt;Damage&lt;/STRONG&gt;&lt;UL&gt;&lt;LI&gt;options are &lt;STRONG&gt;None&lt;/STRONG&gt;, &lt;STRONG&gt;Slight&lt;/STRONG&gt;, &lt;STRONG&gt;Moderate&lt;/STRONG&gt;, &lt;STRONG&gt;Severe&lt;/STRONG&gt; and &lt;STRONG&gt;Destroyed&lt;/STRONG&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;LI&gt;Calculate&amp;nbsp;&lt;STRONG&gt;IsHabitable&lt;/STRONG&gt; - &lt;EM&gt;this is where I need help&lt;/EM&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Rules:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;For all &lt;STRONG&gt;BuildingType&lt;/STRONG&gt; !== &lt;STRONG&gt;Residential&lt;/STRONG&gt;, &lt;STRONG&gt;IsHabitable&lt;/STRONG&gt; = &lt;STRONG&gt;Not Applicable&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;Where &lt;STRONG&gt;BuildingType&lt;/STRONG&gt; == &lt;STRONG&gt;Residential&lt;/STRONG&gt;&lt;UL&gt;&lt;LI&gt;Where &lt;STRONG&gt;Damage&lt;/STRONG&gt; == &lt;STRONG&gt;Severe&lt;/STRONG&gt; || &lt;STRONG&gt;Damage&lt;/STRONG&gt; == &lt;STRONG&gt;Destroyed&lt;/STRONG&gt;, &lt;STRONG&gt;IsHabitable&lt;/STRONG&gt; = &lt;STRONG&gt;Not Habitable&lt;/STRONG&gt;&lt;/LI&gt;&lt;LI&gt;For all other &lt;STRONG&gt;Damage&lt;/STRONG&gt; values, &lt;STRONG&gt;IsHabitable&lt;/STRONG&gt; = &lt;STRONG&gt;Habitable&lt;/STRONG&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;The form element for &lt;STRONG&gt;IsHabitable&lt;/STRONG&gt; has conditional visibility for &lt;STRONG&gt;BuildingType&lt;/STRONG&gt; == &lt;STRONG&gt;Residential&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Questions:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;What Arcade code can I use to calculate the result I need according to the above rules?&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;This is a required field. If I have conditional visibility, will the calculation run if the condition is not met, or do I need to set a default value in the templates with&amp;nbsp;&lt;STRONG&gt;IsHabitable&amp;nbsp;&lt;/STRONG&gt;=&amp;nbsp;&lt;STRONG&gt;Not Applicable&lt;/STRONG&gt;?&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;The calculated value has conditional Editing allowed with a switch value so users can override the calculation.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Mar 2025 13:30:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-field-maps-questions/arcade-help-with-calculated-value-in-field-maps/m-p/1598947#M10600</guid>
      <dc:creator>peterverwey_ses</dc:creator>
      <dc:date>2025-03-25T13:30:34Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade help with calculated value in Field Maps</title>
      <link>https://community.esri.com/t5/arcgis-field-maps-questions/arcade-help-with-calculated-value-in-field-maps/m-p/1598955#M10601</link>
      <description>&lt;P&gt;Here is an example. For this, I start with single conditions and return the function based on that. If it doesn't meet the logic of the if statement it passes to the next logic. Finally if all non-applicable or non-habitable conditions are passed, it return habitable.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;//handles non-residential buildings and returns not applicable
if($feature.BuildingType != 'Residential'){
    return 'Not Applicable'
};

//if it is "Residential" will check for damage and return val
if($feature.Damaga == 'Severe' || $feature.Damage == 'Destroyed'){
    return 'Not Habitable'
};

//if the building is residential and the damage is not severe or destroyed will return this vallue
return 'Habitable'
&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 25 Mar 2025 13:50:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-field-maps-questions/arcade-help-with-calculated-value-in-field-maps/m-p/1598955#M10601</guid>
      <dc:creator>AustinAverill</dc:creator>
      <dc:date>2025-03-25T13:50:54Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade help with calculated value in Field Maps</title>
      <link>https://community.esri.com/t5/arcgis-field-maps-questions/arcade-help-with-calculated-value-in-field-maps/m-p/1598956#M10602</link>
      <description>&lt;P&gt;Misspelled "Damage" on line 6 and didn't catch it until after hitting post.&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":sad_but_relieved_face:"&gt;😥&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Mar 2025 13:51:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-field-maps-questions/arcade-help-with-calculated-value-in-field-maps/m-p/1598956#M10602</guid>
      <dc:creator>AustinAverill</dc:creator>
      <dc:date>2025-03-25T13:51:34Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade help with calculated value in Field Maps</title>
      <link>https://community.esri.com/t5/arcgis-field-maps-questions/arcade-help-with-calculated-value-in-field-maps/m-p/1599031#M10604</link>
      <description>&lt;P&gt;I would write it more traditional like this.&amp;nbsp; easier to follow.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;if($feature.BuildingType != 'Residential'){
    //handles non-residential buildings and returns not applicable
    return 'Not Applicable'
}
else if($feature.Damaga == 'Severe' || $feature.Damage == 'Destroyed'){
    //if it is "Residential" will check for damage and return val
    return 'Not Habitable'
}
else {
    //if the building is residential and the damage is not severe or destroyed will return this vallue
    return 'Habitable'
}&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 25 Mar 2025 15:31:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-field-maps-questions/arcade-help-with-calculated-value-in-field-maps/m-p/1599031#M10604</guid>
      <dc:creator>DougBrowning</dc:creator>
      <dc:date>2025-03-25T15:31:31Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade help with calculated value in Field Maps</title>
      <link>https://community.esri.com/t5/arcgis-field-maps-questions/arcade-help-with-calculated-value-in-field-maps/m-p/1599032#M10605</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/77685"&gt;@AustinAverill&lt;/a&gt;&amp;nbsp;thank you so much for your help.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Turns out I was completely over-thinking everything.&lt;/P&gt;&lt;P&gt;Not only that, I was using string values for an integer based domain. The working code is listed below. Thank you again.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;//handles non-residential buildings and returns not applicable&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;$feature&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;Building_Type_General&lt;/SPAN&gt;&lt;SPAN&gt; != &lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;return&lt;/SPAN&gt; &lt;SPAN&gt;9&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;};&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;//if it is "Residential" will check for damage and return val&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;$feature&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;Damage&lt;/SPAN&gt;&lt;SPAN&gt; == &lt;/SPAN&gt;&lt;SPAN&gt;4&lt;/SPAN&gt;&lt;SPAN&gt; || &lt;/SPAN&gt;&lt;SPAN&gt;$feature&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;Damage&lt;/SPAN&gt;&lt;SPAN&gt; == &lt;/SPAN&gt;&lt;SPAN&gt;5&lt;/SPAN&gt;&lt;SPAN&gt;) {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;return&lt;/SPAN&gt; &lt;SPAN&gt;2&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;};&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;//if the building is residential and the damage is not severe or destroyed will return this value&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;return&lt;/SPAN&gt; &lt;SPAN&gt;1&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Mar 2025 15:31:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-field-maps-questions/arcade-help-with-calculated-value-in-field-maps/m-p/1599032#M10605</guid>
      <dc:creator>peterverwey_ses</dc:creator>
      <dc:date>2025-03-25T15:31:58Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade help with calculated value in Field Maps</title>
      <link>https://community.esri.com/t5/arcgis-field-maps-questions/arcade-help-with-calculated-value-in-field-maps/m-p/1599035#M10606</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/16421"&gt;@DougBrowning&lt;/a&gt;&amp;nbsp;thank you. This is how I would think as well.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Mar 2025 15:33:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-field-maps-questions/arcade-help-with-calculated-value-in-field-maps/m-p/1599035#M10606</guid>
      <dc:creator>peterverwey_ses</dc:creator>
      <dc:date>2025-03-25T15:33:33Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade help with calculated value in Field Maps</title>
      <link>https://community.esri.com/t5/arcgis-field-maps-questions/arcade-help-with-calculated-value-in-field-maps/m-p/1599120#M10607</link>
      <description>&lt;P&gt;Adding the "else if" as statements is definitely probably more technically sound and has a better readable flow. I just didn't do it in my example to really flesh out each logic check as it's own entity for the sake of understanding how the code executes.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Mar 2025 17:06:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-field-maps-questions/arcade-help-with-calculated-value-in-field-maps/m-p/1599120#M10607</guid>
      <dc:creator>AustinAverill</dc:creator>
      <dc:date>2025-03-25T17:06:37Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade help with calculated value in Field Maps</title>
      <link>https://community.esri.com/t5/arcgis-field-maps-questions/arcade-help-with-calculated-value-in-field-maps/m-p/1599123#M10608</link>
      <description>&lt;P&gt;Ahh, yes. Forgetting something is on a integer coded domain will be a hinderance every time!&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":face_with_tears_of_joy:"&gt;😂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Mar 2025 17:07:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-field-maps-questions/arcade-help-with-calculated-value-in-field-maps/m-p/1599123#M10608</guid>
      <dc:creator>AustinAverill</dc:creator>
      <dc:date>2025-03-25T17:07:51Z</dc:date>
    </item>
  </channel>
</rss>

