<?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 Labeling - IF Else help in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-labeling-if-else-help/m-p/1572464#M91615</link>
    <description>&lt;P&gt;I am trying to use IF statements to help build labels for a layer that shows the number of rooms that are within a certain size category.&amp;nbsp; There are five different categories for each building.&amp;nbsp; Each category has its own datafield to store the appropriate number.&amp;nbsp; I want the labels to only display the size category and amount for results greater than zero.&amp;nbsp; That way the label isn't filled up with 0's and wasting space.&lt;/P&gt;&lt;P&gt;Below is what I have tried to write but it has an error with the first IF.&amp;nbsp; Below that is a screenshot of what the labels currently look like.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="What I have tried to write which doesn't work" style="width: 550px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/122678iEEEEA7C22D5142F7/image-size/large?v=v2&amp;amp;px=999" role="button" title="GUCSizeSummaryLabelExample2.jpg" alt="What I have tried to write which doesn't work" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;What I have tried to write which doesn't work&lt;/span&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Current labels" style="width: 984px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/122677i95C476729E5D17ED/image-size/large?v=v2&amp;amp;px=999" role="button" title="GUCSizeSummaryLabelExample.jpg" alt="Current labels" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Current labels&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 03 Jan 2025 16:56:05 GMT</pubDate>
    <dc:creator>BobNichols</dc:creator>
    <dc:date>2025-01-03T16:56:05Z</dc:date>
    <item>
      <title>Arcade Labeling - IF Else help</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-labeling-if-else-help/m-p/1572464#M91615</link>
      <description>&lt;P&gt;I am trying to use IF statements to help build labels for a layer that shows the number of rooms that are within a certain size category.&amp;nbsp; There are five different categories for each building.&amp;nbsp; Each category has its own datafield to store the appropriate number.&amp;nbsp; I want the labels to only display the size category and amount for results greater than zero.&amp;nbsp; That way the label isn't filled up with 0's and wasting space.&lt;/P&gt;&lt;P&gt;Below is what I have tried to write but it has an error with the first IF.&amp;nbsp; Below that is a screenshot of what the labels currently look like.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="What I have tried to write which doesn't work" style="width: 550px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/122678iEEEEA7C22D5142F7/image-size/large?v=v2&amp;amp;px=999" role="button" title="GUCSizeSummaryLabelExample2.jpg" alt="What I have tried to write which doesn't work" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;What I have tried to write which doesn't work&lt;/span&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Current labels" style="width: 984px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/122677i95C476729E5D17ED/image-size/large?v=v2&amp;amp;px=999" role="button" title="GUCSizeSummaryLabelExample.jpg" alt="Current labels" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Current labels&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jan 2025 16:56:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-labeling-if-else-help/m-p/1572464#M91615</guid>
      <dc:creator>BobNichols</dc:creator>
      <dc:date>2025-01-03T16:56:05Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Labeling - IF Else help</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-labeling-if-else-help/m-p/1572471#M91619</link>
      <description>&lt;P&gt;May be your if statements are failing because the number of rooms is a NUMBER? You are querying if it is a TEXT, e.g. $feature.L &amp;lt;&amp;gt; "0"&amp;nbsp; should be $feature.L != 0&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jan 2025 17:08:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-labeling-if-else-help/m-p/1572471#M91619</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2025-01-03T17:08:26Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Labeling - IF Else help</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-labeling-if-else-help/m-p/1572476#M91620</link>
      <description>&lt;P&gt;I gave that a try and still have an "Invalid expression. Error on line 2. Reserved keyword used." message.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jan 2025 17:15:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-labeling-if-else-help/m-p/1572476#M91620</guid>
      <dc:creator>BobNichols</dc:creator>
      <dc:date>2025-01-03T17:15:04Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Labeling - IF Else help</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-labeling-if-else-help/m-p/1572485#M91621</link>
      <description>&lt;P&gt;You need to show your new code, stating the error message without context is not that much use. Also when you share code use the insert code button (via the 3 dots), a screen shot is no use as the first thing people want to do is copy your code and attempt to replicate the issue, you can't do that with a screenshot!&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jan 2025 17:21:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-labeling-if-else-help/m-p/1572485#M91621</guid>
      <dc:creator>DuncanHornby</dc:creator>
      <dc:date>2025-01-03T17:21:58Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Labeling - IF Else help</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-labeling-if-else-help/m-p/1572487#M91622</link>
      <description>&lt;P&gt;Duncan, I found a solution in another post that I was able to modify and make work.&amp;nbsp; See below and thanks for your help!&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var label_array = [$feature.SHORT_NAME]

var counts = {
    '0-29': $feature.S,
    '30-59': $feature.M,
    '60-99': $feature.L,
    '100-149': $feature.XL,
    '150+': $feature.XXL
}

for (var c in counts){
    if(counts[c]&amp;gt;0){
        Push(
            label_array,
            `\t${c}: ${counts[c]}`
        )
    }
}

return Concatenate(
    label_array,
    '\n'
)&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 03 Jan 2025 17:28:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-labeling-if-else-help/m-p/1572487#M91622</guid>
      <dc:creator>BobNichols</dc:creator>
      <dc:date>2025-01-03T17:28:41Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Labeling - IF Else help</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-labeling-if-else-help/m-p/1572570#M91635</link>
      <description>&lt;P&gt;The only thing that I wish I could figure out with the solution is how to set the order in which the label is written from the array.&amp;nbsp; I had hoped that it would sort based on how the array was built, but it writes it alphabetically so the 30-59 and 60-99 categories always show below the 100-149 and 150+ counts.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jan 2025 21:12:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-labeling-if-else-help/m-p/1572570#M91635</guid>
      <dc:creator>BobNichols</dc:creator>
      <dc:date>2025-01-03T21:12:15Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Labeling - IF Else help</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-labeling-if-else-help/m-p/1572798#M91660</link>
      <description>&lt;P&gt;Looping through a dictionary is always done alphabetically, not in the order that you create it. One way to get around that is to modify the dictionary keys to ensure they're in alphabetical order, then removing that part of the key.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var label_array = [$feature.SHORT_NAME]

var counts = {
  "A 0-29": $feature.S,
  "B 30-59": $feature.M,
  "C 60-99": $feature.L,
  "D 100-149": $feature.XL,
  "E 150+": $feature.XXL
};

for (var c in counts) {
  if (counts[c] &amp;gt; 0) {
    Push(label_array, `\t${Mid(c, 2)}: ${counts[c]}`);
  }
}

return Concatenate(label_array, "\n");&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jan 2025 15:32:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-labeling-if-else-help/m-p/1572798#M91660</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2025-01-06T15:32:12Z</dc:date>
    </item>
  </channel>
</rss>

