<?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: How to label with multiple fields when some are empty in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-label-with-multiple-fields-when-some-are/m-p/1132729#M49849</link>
    <description>&lt;P&gt;Copy-paste my script if you have changed the language to Python.&lt;/P&gt;&lt;P&gt;No need to use &lt;STRIKE&gt;$feature.&lt;/STRIKE&gt; Also call the fields from the &lt;STRONG&gt;Fields&lt;/STRONG&gt; list.&lt;/P&gt;&lt;P&gt;Please share screenshot of your label expression as well.&lt;/P&gt;</description>
    <pubDate>Wed, 12 Jan 2022 06:18:57 GMT</pubDate>
    <dc:creator>JayantaPoddar</dc:creator>
    <dc:date>2022-01-12T06:18:57Z</dc:date>
    <item>
      <title>How to label with multiple fields when some are empty</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-label-with-multiple-fields-when-some-are/m-p/1132708#M49845</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am using ArcGIS Pro and trying to get labels in a sensible way. The layer and variables I am using to create labels can have up to five classes (Regional Ecosystems, three in the screen shot below).&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LarissaBoundy_0-1641950696141.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/31244i6BC50B32C1306626/image-size/medium?v=v2&amp;amp;px=400" role="button" title="LarissaBoundy_0-1641950696141.png" alt="LarissaBoundy_0-1641950696141.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I have tried [$feature.RE1 +"/"+$feature.RE2+"/"+ $feature.RE3], which gives the below result, my issue being that when there was only one RE, there are is now // after the label which obviously looks silly.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LarissaBoundy_2-1641950934108.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/31246i466AAB7A9D2119D1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="LarissaBoundy_2-1641950934108.png" alt="LarissaBoundy_2-1641950934108.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LarissaBoundy_1-1641950824182.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/31245i334C846B0390E130/image-size/medium?v=v2&amp;amp;px=400" role="button" title="LarissaBoundy_1-1641950824182.png" alt="LarissaBoundy_1-1641950824182.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Is there a way to get the extra RE labels and / to only appear if the field is not empty?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jan 2022 03:43:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-label-with-multiple-fields-when-some-are/m-p/1132708#M49845</guid>
      <dc:creator>LarissaBoundy</dc:creator>
      <dc:date>2022-01-12T03:43:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to label with multiple fields when some are empty</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-label-with-multiple-fields-when-some-are/m-p/1132715#M49846</link>
      <description>&lt;P&gt;Could you use Python Language?&lt;/P&gt;&lt;P&gt;Could you check if &lt;STRONG&gt;rstrip('/')&lt;/STRONG&gt; function works for you?&lt;/P&gt;&lt;LI-CODE lang="python"&gt;([RE1]+'/'+[RE2]+'/'+[RE3]).rstrip('/')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jan 2022 04:41:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-label-with-multiple-fields-when-some-are/m-p/1132715#M49846</guid>
      <dc:creator>JayantaPoddar</dc:creator>
      <dc:date>2022-01-12T04:41:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to label with multiple fields when some are empty</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-label-with-multiple-fields-when-some-are/m-p/1132726#M49847</link>
      <description>&lt;P&gt;Hi Jayanta,&lt;/P&gt;&lt;P&gt;Thanks for your comment. I just tried that, got an error message, and&amp;nbsp;($feature.RE1 +"/"+$feature.RE2+"/"+ $feature.RE3).rstrip('/')&lt;/P&gt;&lt;P&gt;For both I got the message&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LarissaBoundy_0-1641963590456.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/31252iB85EE5DF1C1F3D26/image-size/medium?v=v2&amp;amp;px=400" role="button" title="LarissaBoundy_0-1641963590456.png" alt="LarissaBoundy_0-1641963590456.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jan 2022 05:35:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-label-with-multiple-fields-when-some-are/m-p/1132726#M49847</guid>
      <dc:creator>LarissaBoundy</dc:creator>
      <dc:date>2022-01-12T05:35:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to label with multiple fields when some are empty</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-label-with-multiple-fields-when-some-are/m-p/1132729#M49849</link>
      <description>&lt;P&gt;Copy-paste my script if you have changed the language to Python.&lt;/P&gt;&lt;P&gt;No need to use &lt;STRIKE&gt;$feature.&lt;/STRIKE&gt; Also call the fields from the &lt;STRONG&gt;Fields&lt;/STRONG&gt; list.&lt;/P&gt;&lt;P&gt;Please share screenshot of your label expression as well.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jan 2022 06:18:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-label-with-multiple-fields-when-some-are/m-p/1132729#M49849</guid>
      <dc:creator>JayantaPoddar</dc:creator>
      <dc:date>2022-01-12T06:18:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to label with multiple fields when some are empty</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-label-with-multiple-fields-when-some-are/m-p/1132731#M49850</link>
      <description>&lt;P&gt;Thank you, I hadn't changed language to Python, but still did not work&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LarissaBoundy_0-1641968456352.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/31253i195E08E2D4AAC439/image-size/medium?v=v2&amp;amp;px=400" role="button" title="LarissaBoundy_0-1641968456352.png" alt="LarissaBoundy_0-1641968456352.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jan 2022 06:21:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-label-with-multiple-fields-when-some-are/m-p/1132731#M49850</guid>
      <dc:creator>LarissaBoundy</dc:creator>
      <dc:date>2022-01-12T06:21:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to label with multiple fields when some are empty</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-label-with-multiple-fields-when-some-are/m-p/1132737#M49853</link>
      <description>&lt;P&gt;alright. Check this one (Python)&lt;/P&gt;&lt;LI-CODE lang="c"&gt;(([RE1]+'/'+[RE2]+'/'+[RE3]).rstrip('/ / ')).rstrip('/')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;LI-CODE lang="python"&gt;([RE1]+'/'+[RE2]+'/'+[RE3]).replace('/ /','')&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 12 Jan 2022 06:47:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-label-with-multiple-fields-when-some-are/m-p/1132737#M49853</guid>
      <dc:creator>JayantaPoddar</dc:creator>
      <dc:date>2022-01-12T06:47:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to label with multiple fields when some are empty</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-label-with-multiple-fields-when-some-are/m-p/1132751#M49857</link>
      <description>&lt;P&gt;Not the most elegant solution, but you could employ the&amp;nbsp;&lt;SPAN&gt;removeEmpty parameter from &lt;A href="https://developers.arcgis.com/arcade/function-reference/text_functions/#split" target="_self"&gt;Split&lt;/A&gt; (Arcade). I.e. concatenate the values using &lt;A href="https://developers.arcgis.com/arcade/function-reference/text_functions/#concatenate-values--separator--format----text" target="_blank" rel="noopener"&gt;Concatenate&lt;/A&gt;&lt;/SPAN&gt;&lt;SPAN&gt;, split the new string with the removeEmpty parameter set and then concatenate again to get your label.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jan 2022 07:59:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-label-with-multiple-fields-when-some-are/m-p/1132751#M49857</guid>
      <dc:creator>HuubZwart</dc:creator>
      <dc:date>2022-01-12T07:59:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to label with multiple fields when some are empty</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-label-with-multiple-fields-when-some-are/m-p/1132752#M49858</link>
      <description>&lt;P&gt;I use something like this in the advanced expression of Python:&lt;/P&gt;&lt;P&gt;def FindLabel ([RE1],[RE2],[RE3]):&lt;BR /&gt;a = [RE1]&lt;BR /&gt;b = [RE2]&lt;BR /&gt;c = [RE3]&lt;BR /&gt;return "/".join([str(i) for i in [a, b, c] if i is not None])&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jan 2022 07:59:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-label-with-multiple-fields-when-some-are/m-p/1132752#M49858</guid>
      <dc:creator>IlkaIllers1</dc:creator>
      <dc:date>2022-01-12T07:59:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to label with multiple fields when some are empty</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-label-with-multiple-fields-when-some-are/m-p/1132756#M49860</link>
      <description>&lt;P&gt;Sorry, I just tried it and realised it doesn't work with "/". It still has the unwanted extra //. Curious! The same code with ", " instead works fine for me. I don't know why, sorry!&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;def FindLabel ([RE1],[RE2],[RE3]):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;a = [RE1]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;b = [RE2]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;c = [RE3]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;return ", ".join([str(i) for i in [a, b, c] if i is not None])&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jan 2022 08:04:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-label-with-multiple-fields-when-some-are/m-p/1132756#M49860</guid>
      <dc:creator>IlkaIllers1</dc:creator>
      <dc:date>2022-01-12T08:04:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to label with multiple fields when some are empty</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-label-with-multiple-fields-when-some-are/m-p/1132765#M49863</link>
      <description>&lt;P&gt;Well, I was foiled by my own data! Turns out it does work when you check that fields are really None (&amp;lt;Null&amp;gt;) instead of empty! This is my failsafe expression:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;def FindLabel ([RE1],[RE2],[RE3]):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; a = [RE1]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; b = [RE2]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; c = [RE3]&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; return "/".join([str(i) for i in [a, b, c] if i is not None and i !=""])&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jan 2022 08:37:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-label-with-multiple-fields-when-some-are/m-p/1132765#M49863</guid>
      <dc:creator>IlkaIllers1</dc:creator>
      <dc:date>2022-01-12T08:37:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to label with multiple fields when some are empty</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-label-with-multiple-fields-when-some-are/m-p/1132768#M49865</link>
      <description>&lt;LI-CODE lang="javascript"&gt;var raw_re = [$feature.RE1, $feature.RE2, $feature.RE3, $feature.RE4, $feature.RE5]
var filled_re = []
for(var i in raw_re) {
  if(!IsEmpty(raw_re[i])) {
    Push(filled_re, raw_re[i])
  }
}
return Concatenate(filled_re, "/")&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 12 Jan 2022 09:15:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-label-with-multiple-fields-when-some-are/m-p/1132768#M49865</guid>
      <dc:creator>JohannesLindner</dc:creator>
      <dc:date>2022-01-12T09:15:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to label with multiple fields when some are empty</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-label-with-multiple-fields-when-some-are/m-p/1133124#M49920</link>
      <description>&lt;P&gt;IlkaIllers1&amp;nbsp;handling of None is important. Null requires special handling.&lt;BR /&gt;Null in the attribute table means&amp;nbsp;None in python.&amp;nbsp;&lt;BR /&gt;And None plus anything equals None&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jan 2022 22:26:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-label-with-multiple-fields-when-some-are/m-p/1133124#M49920</guid>
      <dc:creator>MicZatorsky_AEC</dc:creator>
      <dc:date>2022-01-12T22:26:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to label with multiple fields when some are empty</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-label-with-multiple-fields-when-some-are/m-p/1133201#M49931</link>
      <description>&lt;P&gt;Thank you so much you legend, the first one was successful.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jan 2022 00:53:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-label-with-multiple-fields-when-some-are/m-p/1133201#M49931</guid>
      <dc:creator>LarissaBoundy</dc:creator>
      <dc:date>2022-01-13T00:53:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to label with multiple fields when some are empty</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/how-to-label-with-multiple-fields-when-some-are/m-p/1133202#M49932</link>
      <description>&lt;P&gt;Thank you everyone, Jayanta's suggestion below was successful!&lt;/P&gt;&lt;PRE&gt;(([RE1]+'/'+[RE2]+'/'+[RE3]).rstrip('/ / ')).rstrip('/')&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jan 2022 00:54:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/how-to-label-with-multiple-fields-when-some-are/m-p/1133202#M49932</guid>
      <dc:creator>LarissaBoundy</dc:creator>
      <dc:date>2022-01-13T00:54:37Z</dc:date>
    </item>
  </channel>
</rss>

