<?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 Labeling based on NULL or NOT NULL values in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-labeling-based-on-null-or-not-null-values/m-p/1051970#M40316</link>
    <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/2839"&gt;@KenBuja&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I get the below error when trying to update on my end. It is a direct copy and paste, all I did was keep the '$feature.' in front of each variable.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.PNG" style="width: 712px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/11992iABCBE529AF3F05FD/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.PNG" alt="image.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 27 Apr 2021 20:50:22 GMT</pubDate>
    <dc:creator>Brian_McLeer</dc:creator>
    <dc:date>2021-04-27T20:50:22Z</dc:date>
    <item>
      <title>Arcade Labeling based on NULL or NOT NULL values</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-labeling-based-on-null-or-not-null-values/m-p/1051904#M40307</link>
      <description>&lt;P&gt;We have a description field in our address feature class and one of the values is 'BUSINESS'. We have two other fields, Unit Number and Building Number. In working to migrate labeling language from VB Script to Arcade, we would like to label on the following conditions:&lt;/P&gt;&lt;P&gt;Applies to all where the description is BUSINESS&lt;/P&gt;&lt;P&gt;&amp;nbsp;- If the building number is not null, label the building number and not the situs number.&lt;/P&gt;&lt;P&gt;&amp;nbsp;- if the unit number is not null, label the unit number and not the situs number.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;- If the building and unit numbers are both NULL, label the situs number&lt;/P&gt;&lt;P&gt;-&amp;nbsp; Not often, but if both unit number and building number are both not null, label both unit number and building number, do not label situs number&lt;/P&gt;&lt;P&gt;Below is the code that I currently am working with. The portion that pertains to my question is where the description is 'BUSINESS'.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;var d = $feature.Description
var s = $feature.SitusNum
var u = $feature.UnitNum
var b = $feature.BuildingNum

if(d == 'SINGLE'){
    return s
} else if(d == 'TOWNHOME'){
    return s
} else if(d == 'ACCESSORY DWELLING'){
    if(IsEmpty(u)){
        return s}
    else{
        return s + ' - ' + u}
} else if(d == 'DUPLEX'){
    if(IsEmpty(u)){
        return s}
    else{
        return s + ' - ' + u}
} else if(d == 'MANUFACTURED'){
    if(IsEmpty(u)){
        return s}
    else{
        return s + ' - ' + u}
} else if(d == 'CONDO'){
    if(IsEmpty(u)){
        return s}
    else{
        return u}
} else if(d == 'MULTIFAMILY'){
    if(IsEmpty(u)){
        return s}
    else{
        return u}
} else if(d == 'BUSINESS'){
    if(IsEmpty(b)){
        return s}
    else{
        return b}
} else if(d == 'BUSINESS'){
    if(IsEmpty(u)){
        return s}
    else{
        return u}
} else if(d == 'CARE FACILITY'){
    if(IsEmpty(u)){
        return s}
    else{
        return u}
} else if(d == 'PRIVATE PARK'){
    return s
} else if(d == 'PUBLIC FACILITY'){
    if(IsEmpty(u)){
        return s}
    else{
        return u}
} else if(d == 'GARAGE'){
    if(IsEmpty(u)){
        return s}
    else{
        return u}
} else if(d == 'PARKING GARAGE'){
    return s
} else if(d == 'STORAGE UNIT'){
    if(IsEmpty(u)){
        return s}
    else{
        return u}
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Apr 2021 18:47:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-labeling-based-on-null-or-not-null-values/m-p/1051904#M40307</guid>
      <dc:creator>Brian_McLeer</dc:creator>
      <dc:date>2021-04-27T18:47:13Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Labeling based on NULL or NOT NULL values</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-labeling-based-on-null-or-not-null-values/m-p/1051930#M40308</link>
      <description>&lt;P&gt;The issue is that a return statement ends a function (moves on to the next feature).&lt;/P&gt;&lt;P&gt;You might have better luck creating something like var result = ''&amp;nbsp;&lt;/P&gt;&lt;P&gt;and then creating a result string, at the end of your conditionals you just have:&lt;/P&gt;&lt;P&gt;return result.&lt;/P&gt;&lt;P&gt;Or something like:&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="javascript"&gt;else if(d == 'BUSINESS'){
    if(IsEmpty(b) == False &amp;amp;&amp;amp; IsEmpty(u) == False){
        return (b + ', ' + u)}
    else if(IsEmpty(b) == False){
        return b}
    else if(IsEmpty(u) == False){
        return u}
    else if(IsEmpty(b) &amp;amp;&amp;amp; IsEmpty(u)){
        return s}
}&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;</description>
      <pubDate>Tue, 27 Apr 2021 19:47:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-labeling-based-on-null-or-not-null-values/m-p/1051930#M40308</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2021-04-27T19:47:17Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Labeling based on NULL or NOT NULL values</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-labeling-based-on-null-or-not-null-values/m-p/1051934#M40311</link>
      <description>&lt;P&gt;It may be easier to visualize this using the &lt;A href="https://developers.arcgis.com/arcade/function-reference/logical_functions/#when" target="_self"&gt;When&lt;/A&gt; function and consolidating the conditions with the same responses using the || (or) operator (this is just showing some of them).&lt;/P&gt;&lt;P&gt;The building response was a little more complex, but I think this covers all bases. This is how I tested it in the Arcade playground.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var d = 'BUSINESS'
var s = 'SitusNum'
var u = 'UnitNum' //UnitNum
var b = 'BuildingNum' //BuildingNum

return When(d == 'SINGLE' || d == 'TOWNHOME', s,
            d == 'DUPLEX', IIf(IsEmpty(u), s, s + ' - ' + u),
            d == 'BUSINESS', 
              IIf(IsEmpty(b) &amp;amp;&amp;amp; IsEmpty(u), s, 
                IIf(!IsEmpty(b) &amp;amp;&amp;amp; !IsEmpty(u), b + ' - ' + u,
                  IIf(!IsEmpty(b), b, IIf(!IsEmpty(u), u, null)))),
           null)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Apr 2021 19:49:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-labeling-based-on-null-or-not-null-values/m-p/1051934#M40311</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2021-04-27T19:49:43Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Labeling based on NULL or NOT NULL values</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-labeling-based-on-null-or-not-null-values/m-p/1051950#M40314</link>
      <description>&lt;P&gt;This is even cleaner:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;var d = 'BUSINESS'
var s = 'SitusNum'
var u = 'UnitNum' //UnitNum
var b = 'BuildingNum' //BuildingNum

return When(d == 'SINGLE' || d == 'TOWNHOME', s,
            d == 'DUPLEX', IIf(IsEmpty(u), s, s + ' - ' + u),
            d == 'BUSINESS', 
              IIf(!IsEmpty(b) &amp;amp;&amp;amp; !IsEmpty(u), b + ' - ' + u,
                IIf(!IsEmpty(b), b, 
                  IIf(!IsEmpty(u), u, s)
                )
              ),
           null)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Apr 2021 20:27:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-labeling-based-on-null-or-not-null-values/m-p/1051950#M40314</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2021-04-27T20:27:41Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Labeling based on NULL or NOT NULL values</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-labeling-based-on-null-or-not-null-values/m-p/1051970#M40316</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/2839"&gt;@KenBuja&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I get the below error when trying to update on my end. It is a direct copy and paste, all I did was keep the '$feature.' in front of each variable.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.PNG" style="width: 712px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/11992iABCBE529AF3F05FD/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.PNG" alt="image.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Apr 2021 20:50:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-labeling-based-on-null-or-not-null-values/m-p/1051970#M40316</guid>
      <dc:creator>Brian_McLeer</dc:creator>
      <dc:date>2021-04-27T20:50:22Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Labeling based on NULL or NOT NULL values</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-labeling-based-on-null-or-not-null-values/m-p/1051988#M40317</link>
      <description>&lt;P&gt;Hmmm...I tested a version of this in Pro using my data and it performed as expected.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="arcade.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/11999i1619E51956316EDE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="arcade.png" alt="arcade.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;What happens if you start by adding one When condition at a time?&lt;/P&gt;</description>
      <pubDate>Tue, 27 Apr 2021 21:23:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-labeling-based-on-null-or-not-null-values/m-p/1051988#M40317</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2021-04-27T21:23:47Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Labeling based on NULL or NOT NULL values</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-labeling-based-on-null-or-not-null-values/m-p/1052303#M40352</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/2839"&gt;@KenBuja&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried again and I got the below to work based on your feedback. I also created a new label class just for where the description is business so I was not trying to do so much in one label class. Thank you very much for your help!&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;var d = $feature.Description
var s = $feature.SitusNum
var u = $feature.UnitNum
var b = $feature.BuildingNum

return When(d == 'BUSINESS', 
              IIf(!IsEmpty(b) &amp;amp;&amp;amp; !IsEmpty(u), b + ' - ' + u,
                IIf(!IsEmpty(b), b, 
                  IIf(!IsEmpty(u), u, s)
                )
              ),
           null)&lt;/LI-CODE&gt;&lt;P&gt;.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Apr 2021 15:05:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-labeling-based-on-null-or-not-null-values/m-p/1052303#M40352</guid>
      <dc:creator>Brian_McLeer</dc:creator>
      <dc:date>2021-04-28T15:05:36Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade Labeling based on NULL or NOT NULL values</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-labeling-based-on-null-or-not-null-values/m-p/1195975#M57758</link>
      <description>&lt;P&gt;This worked for me, too. Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jul 2022 16:13:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-labeling-based-on-null-or-not-null-values/m-p/1195975#M57758</guid>
      <dc:creator>RyanTaylor10</dc:creator>
      <dc:date>2022-07-26T16:13:32Z</dc:date>
    </item>
  </channel>
</rss>

