<?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: Need help with Arcade expression for symbolizing room vacancy in ArcGIS Enterprise Portal Questions</title>
    <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/need-help-with-arcade-expression-for-symbolizing/m-p/1334207#M14077</link>
    <description>&lt;P&gt;I realized that using this expression to populate a new field wouldn't provide the 'live' functionality that I need, since I don't know how to continuously re-calculate a field in order for it to reflect immediate changes.&amp;nbsp; It is functioning perfectly as a symbology expression, and I was able to adapt it for use as a labeling expression to display the number of vacant beds per room by swapping this in at the end:&lt;/P&gt;&lt;P&gt;return When($feature.capacity == 0, "",&lt;BR /&gt;Number($feature.capacity - occupants))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you again.&amp;nbsp;&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 02 Oct 2023 16:57:25 GMT</pubDate>
    <dc:creator>JDenham</dc:creator>
    <dc:date>2023-10-02T16:57:25Z</dc:date>
    <item>
      <title>Need help with Arcade expression for symbolizing room vacancy</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/need-help-with-arcade-expression-for-symbolizing/m-p/1333586#M14073</link>
      <description>&lt;P&gt;I'm working on a sleeping room web application, and I need help creating a symbology expression to draw attention to rooms with vacant beds available.&amp;nbsp; My data is polygon data, representing the individual rooms.&amp;nbsp; I'm planning to use the stock "capacity" field to note how many beds each sleeping room has.&amp;nbsp; &amp;nbsp; I then have 4 occupant fields (occupant_1, occupant_2 etc.).&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need an expression that will compare the quantity of non-Null occupant fields with the value in the 'capacity' field.&amp;nbsp; I'd would like to be able to symbolize the output with Gray for Capacity = 0, Green for Vacancy (the number of non-Null occupant fields is less than 'capacity' value), and Red for Full (number of non-Null occupant fields is equal to 'capacity' value).&lt;/P&gt;&lt;P&gt;I am not familiar with how to assemble Arcade expressions, so any help would be much appreciated.&lt;/P&gt;&lt;P&gt;*Edit to add-&amp;nbsp; I own the data table, so if it is best to use an arcade expression to calculate a new field as an intermediate before symbolizing, that is a possibility as well.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Sep 2023 21:12:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/need-help-with-arcade-expression-for-symbolizing/m-p/1333586#M14073</guid>
      <dc:creator>JDenham</dc:creator>
      <dc:date>2023-09-28T21:12:39Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with Arcade expression for symbolizing room vacancy</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/need-help-with-arcade-expression-for-symbolizing/m-p/1333597#M14074</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/151353"&gt;@AmandaStanko&lt;/a&gt;&amp;nbsp;@&amp;nbsp;or&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/24170"&gt;@JenniferBell&lt;/a&gt;&amp;nbsp;, would you be able to provide some helpful pointers for Jeremy?&lt;/P&gt;</description>
      <pubDate>Thu, 28 Sep 2023 21:14:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/need-help-with-arcade-expression-for-symbolizing/m-p/1333597#M14074</guid>
      <dc:creator>MVieng</dc:creator>
      <dc:date>2023-09-28T21:14:48Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with Arcade expression for symbolizing room vacancy</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/need-help-with-arcade-expression-for-symbolizing/m-p/1333603#M14075</link>
      <description>&lt;P&gt;Give this a try. This &lt;A href="https://developers.arcgis.com/arcade/guide/loops/#array" target="_self"&gt;loops&lt;/A&gt; through the array of field names to count how many &lt;A href="https://developers.arcgis.com/arcade/function-reference/logical_functions/#isempty" target="_self"&gt;aren't empty&lt;/A&gt;. Then it returns the result of the &lt;A href="https://developers.arcgis.com/arcade/function-reference/logical_functions/#when" target="_self"&gt;When&lt;/A&gt; function, which checks if the capacity is empty and if the capacity is greater than the number of occupants or not. And it's good practice to use the &lt;A href="https://developers.arcgis.com/arcade/function-reference/feature_functions/#expects" target="_self"&gt;Expects&lt;/A&gt; function when getting fields from an array like this.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Expects($feature,'capacity', 'occupant_1', 'occupant_2', 'occupant_3', 'occupant_4');
var fields = ['occupant_1', 'occupant_2', 'occupant_3', 'occupant_4'];
var occupants = 0

for(var index in fields) {
  if (!IsEmpty($feature[fields[index]])) occupants += 1;
}

return when ($feature.capacity == 0, 'Gray',
             $feature.capacity &amp;gt; occupants, 'Green',
             'Red');&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;</description>
      <pubDate>Thu, 28 Sep 2023 21:26:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/need-help-with-arcade-expression-for-symbolizing/m-p/1333603#M14075</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2023-09-28T21:26:43Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with Arcade expression for symbolizing room vacancy</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/need-help-with-arcade-expression-for-symbolizing/m-p/1333611#M14076</link>
      <description>&lt;P&gt;Thank you for an incredibly fast response.&amp;nbsp; That seems to work perfectly.&amp;nbsp; I'll continue working with this to see if it needs to be tweaked at all, but it's doing exactly what I needed.&lt;/P&gt;&lt;P&gt;I did change the outputs to "N/A", "Vacancy", and "Full" and then applied the appropriate color in symbology.&amp;nbsp; I'll do further testing, and may use the expression to populate a vacancy_status field and symbolize from that field so that any exported table data will capture the status also.&lt;/P&gt;&lt;P&gt;Much appreciated.&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Sep 2023 21:54:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/need-help-with-arcade-expression-for-symbolizing/m-p/1333611#M14076</guid>
      <dc:creator>JDenham</dc:creator>
      <dc:date>2023-09-28T21:54:24Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with Arcade expression for symbolizing room vacancy</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-portal-questions/need-help-with-arcade-expression-for-symbolizing/m-p/1334207#M14077</link>
      <description>&lt;P&gt;I realized that using this expression to populate a new field wouldn't provide the 'live' functionality that I need, since I don't know how to continuously re-calculate a field in order for it to reflect immediate changes.&amp;nbsp; It is functioning perfectly as a symbology expression, and I was able to adapt it for use as a labeling expression to display the number of vacant beds per room by swapping this in at the end:&lt;/P&gt;&lt;P&gt;return When($feature.capacity == 0, "",&lt;BR /&gt;Number($feature.capacity - occupants))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you again.&amp;nbsp;&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Oct 2023 16:57:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-portal-questions/need-help-with-arcade-expression-for-symbolizing/m-p/1334207#M14077</guid>
      <dc:creator>JDenham</dc:creator>
      <dc:date>2023-10-02T16:57:25Z</dc:date>
    </item>
  </channel>
</rss>

