<?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 - labels in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-help-labels/m-p/1408950#M81768</link>
    <description>&lt;P&gt;You could try a When statement like&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var AID = $feature.AssetID

var DIA = $feature.diameter

var Wid = $feature.width

When(AID != null, 'X', DIA != null &amp;amp;&amp;amp; WID == null, 'Y', DIA != null &amp;amp;&amp;amp; WID == 'UNKNOWN', 'Y', '')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Admittedly, Arcade labeling can feel really limited and I don't actually know if this will work.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 12 Apr 2024 12:58:29 GMT</pubDate>
    <dc:creator>ZachBodenner</dc:creator>
    <dc:date>2024-04-12T12:58:29Z</dc:date>
    <item>
      <title>Arcade help - labels</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-help-labels/m-p/1408914#M81765</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Apologies if my terminology is incorrect - I'm a novice in Arcade.&lt;/P&gt;&lt;P&gt;I am trying to avoid having multiple label classes by merging my individual arcade label class expressions into one. However I am finding that if one return is met, the following return will not be labelled.&lt;/P&gt;&lt;P&gt;Perhaps the best explanation is an example:&lt;/P&gt;&lt;P&gt;I want to label X when ASSETID is not NULL, additionally i want to label Y when DIAMETER is not NULL AND when width is either NULL or "UNKNOWN".&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="c"&gt;if (IsEmpty($feature.ASSETID) == False){
return "X"}

else if ((IsEmpty($feature.DIAMETER) == False) &amp;amp;&amp;amp; ((IsEmpty($feature.WIDTH)) || ($feature.WIDTH == "UNKNOWN")))
    if ($feature.DIAMETER != "UNKNOWN"){
    return "Y"}&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;I want both labels to appear, but it seems if X is labelled then Y isnt dealt with. I will eventually have a few more labels (eg Z...) I want to also include but am hoping to get this working first.&lt;/P&gt;&lt;P&gt;In researching I have found examples on how to create multiple if else expressions on a single label but haven't found anything on creating multiple labels without any relationship to the previous "returns" output within the one label expression.&lt;/P&gt;&lt;P&gt;Thanks for taking your time to look at this and I hope this makes sense.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Amber&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2024 09:36:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-help-labels/m-p/1408914#M81765</guid>
      <dc:creator>AmberKelly</dc:creator>
      <dc:date>2024-04-12T09:36:19Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade help - labels</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-help-labels/m-p/1408948#M81767</link>
      <description>&lt;P&gt;Any time you have a &lt;STRONG&gt;return&lt;/STRONG&gt;, that &lt;EM&gt;ends &lt;/EM&gt;the expression, and nothing after that will be evaluated. Also, whether you have a return in the first block or not, since the second condition has "else" in front of it, it will &lt;EM&gt;only &lt;/EM&gt;evaluate if the preceding condition is &lt;EM&gt;false&lt;/EM&gt;.&lt;/P&gt;&lt;P&gt;And also, the second condition block has a nested If statement, but only a single closing bracket, so it would probably throw an error if the expression got past the first condition.&lt;/P&gt;&lt;P&gt;If you're trying to build an expression one piece at a time, there are a couple ways to do it. A common approach is to create a text variable and stick more text onto the end of it as needed.&lt;/P&gt;&lt;P&gt;Personally, I like to move values into an array and use Concatenate, but I'll show you both. Here's with text:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var out_text = ''

// label X when ASSETID not null; note using "!" to negate a statement
if ( !IsEmpty($feature.ASSETID) ) {
  out_text += 'X'
}

// label Y when DIAMETER not null and width null / UNKNOWN
if ( !IsEmpty($feature.DIAMETER) &amp;amp;&amp;amp; ( IsEmpty($feature.WIDTH) || $feature.WIDTH == 'UNKNOWN' )) {
  out_text += '\nY'  // include a line break to keep separate from X, if both show up
}

return out_text&lt;/LI-CODE&gt;&lt;P&gt;And with an array:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var out_arr = []

// label X when ASSETID not null; note using "!" to negate a statement
if ( !IsEmpty($feature.ASSETID) ) {
  Push(out_arr, 'X')
}

// label Y when DIAMETER not null and width null / UNKNOWN
if ( !IsEmpty($feature.DIAMETER) &amp;amp;&amp;amp; ( IsEmpty($feature.WIDTH) || $feature.WIDTH == 'UNKNOWN' )) {
  Push(out_arr, 'Y')
}

return Concatenate(out_arr, '\n')&lt;/LI-CODE&gt;&lt;P&gt;The array approach has the benefit of only inserting line breaks when necessary. The text variable option will probably end up inserting too many line breaks in some situations.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2024 12:50:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-help-labels/m-p/1408948#M81767</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2024-04-12T12:50:01Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade help - labels</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-help-labels/m-p/1408950#M81768</link>
      <description>&lt;P&gt;You could try a When statement like&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var AID = $feature.AssetID

var DIA = $feature.diameter

var Wid = $feature.width

When(AID != null, 'X', DIA != null &amp;amp;&amp;amp; WID == null, 'Y', DIA != null &amp;amp;&amp;amp; WID == 'UNKNOWN', 'Y', '')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Admittedly, Arcade labeling can feel really limited and I don't actually know if this will work.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2024 12:58:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-help-labels/m-p/1408950#M81768</guid>
      <dc:creator>ZachBodenner</dc:creator>
      <dc:date>2024-04-12T12:58:29Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade help - labels</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-help-labels/m-p/1409528#M81827</link>
      <description>&lt;P&gt;Thanks for your help with this one Zach. It didnt play ball exactly as I had intended but has led me down an interesting path learning about When statements.&lt;/P&gt;&lt;P&gt;Much thanks!&lt;/P&gt;</description>
      <pubDate>Sun, 14 Apr 2024 22:27:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-help-labels/m-p/1409528#M81827</guid>
      <dc:creator>AmberKelly</dc:creator>
      <dc:date>2024-04-14T22:27:27Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade help - labels</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-help-labels/m-p/1409529#M81828</link>
      <description>&lt;P&gt;Josh - so much gold in this reply! I've copied it to my notes for future reference.&lt;/P&gt;&lt;P&gt;Thanks this has done just what I was after - thank you for explaining why an array is the preferred option too.&lt;/P&gt;&lt;P&gt;Gotta love the internet!&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 14 Apr 2024 22:30:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-help-labels/m-p/1409529#M81828</guid>
      <dc:creator>AmberKelly</dc:creator>
      <dc:date>2024-04-14T22:30:32Z</dc:date>
    </item>
  </channel>
</rss>

