<?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 expression too long in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-expression-too-long/m-p/1159748#M53479</link>
    <description>&lt;P&gt;hmmm... PEYTO PEYTO :))) I wish I can meme-it somehow &lt;span class="lia-unicode-emoji" title=":red_heart:"&gt;❤️&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KristineDanielaShepherdson_0-1648698683288.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/37812iC2E7A22F2B4446B3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="KristineDanielaShepherdson_0-1648698683288.png" alt="KristineDanielaShepherdson_0-1648698683288.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 31 Mar 2022 04:00:23 GMT</pubDate>
    <dc:creator>Kristine-DanielaShepherdson</dc:creator>
    <dc:date>2022-03-31T04:00:23Z</dc:date>
    <item>
      <title>Arcade expression too long</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-expression-too-long/m-p/1159052#M53398</link>
      <description>&lt;P&gt;I was trying to figure out a way to create an if clause to label some disposition features using the "company" attribute. Unfortunately, there isn't much space on the map so I had to truncate the field and use the first word (no abbreviation field in the data either). The problem is that sometimes, the company name's first word can be something really short: 2 or 3 letters. So, I made an expression that uses an if clause to display 2 words from the company name, if the first one is 3 characters or less.&lt;/P&gt;&lt;P&gt;I feel the expression might be a bit too long/complicated/"not elegant". Does anyone have a nicer way of doing this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;var A = Split($feature.company," ")[0]+" "&lt;/P&gt;&lt;P&gt;var B = Split($feature.company," ")[1]+ "\n"+$feature.disp_num&lt;/P&gt;&lt;P&gt;var C = Split($feature.company," ")[0]+ "\n"+$feature.disp_num&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;var lttr1 = $feature.company[0]&lt;/P&gt;&lt;P&gt;var lttr2 = $feature.company[1]&lt;/P&gt;&lt;P&gt;var lttr3 = $feature.company[2]&lt;/P&gt;&lt;P&gt;var lttr4 = $feature.company[3]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if (lttr1 ==" ")&lt;/P&gt;&lt;P&gt;A+B&lt;/P&gt;&lt;P&gt;else if (lttr2 ==" ")&lt;/P&gt;&lt;P&gt;A+B&lt;/P&gt;&lt;P&gt;else if (lttr3 ==" ")&lt;/P&gt;&lt;P&gt;A+B&lt;/P&gt;&lt;P&gt;else if (lttr4 ==" ")&lt;/P&gt;&lt;P&gt;A+B&lt;/P&gt;&lt;P&gt;else&lt;/P&gt;&lt;P&gt;C&lt;/P&gt;</description>
      <pubDate>Tue, 29 Mar 2022 19:18:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-expression-too-long/m-p/1159052#M53398</guid>
      <dc:creator>Kristine-DanielaShepherdson</dc:creator>
      <dc:date>2022-03-29T19:18:05Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression too long</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-expression-too-long/m-p/1159091#M53406</link>
      <description>&lt;P&gt;Yes, there's certainly an 'elegant' way to come at this.&lt;/P&gt;&lt;P&gt;First, you should assign the output of&amp;nbsp;&lt;STRONG&gt;Split&amp;nbsp;&lt;/STRONG&gt;to a variable so that you can access it, rather than calling the function repeatedly.&lt;/P&gt;&lt;P&gt;Secondly, we can use&amp;nbsp;&lt;STRONG&gt;Count&amp;nbsp;&lt;/STRONG&gt;to get the length of a string, and use that to check for short words, rather than look at the values of individual letters.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// Create array from company name
var name_parts = Split($feature.company, ' ')

// Check length of first value. If &amp;gt; 3, just return the first word, otherwise, get the first two.
if (Count(name_parts[0]) &amp;gt; 3){
    return name_parts[0]
} else {
    return `${name_parts[0]}\n${name_parts[1]}`
}&lt;/LI-CODE&gt;&lt;P&gt;Here's that expression, with a long first word:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jcarlson_1-1648585159370.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/37628iB1F1EDFCD8ED6469/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jcarlson_1-1648585159370.png" alt="jcarlson_1-1648585159370.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;And here it is with a short word:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jcarlson_2-1648585182977.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/37629i4B68F2EFA3F4F12F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jcarlson_2-1648585182977.png" alt="jcarlson_2-1648585182977.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Mar 2022 20:19:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-expression-too-long/m-p/1159091#M53406</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2022-03-29T20:19:32Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression too long</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-expression-too-long/m-p/1159097#M53408</link>
      <description>&lt;P&gt;This is shorter.... if it does what you want....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var A = Split($feature.Company,' ', -1, true)
iif(Count(A[0]) &amp;lt; 3, A[0] + " " + A[1] + "\n" + $feature.disp_num, A[0] + "\n" +$feature.disp_num)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Mar 2022 20:34:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-expression-too-long/m-p/1159097#M53408</guid>
      <dc:creator>KimberlyGarbade</dc:creator>
      <dc:date>2022-03-29T20:34:40Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression too long</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-expression-too-long/m-p/1159748#M53479</link>
      <description>&lt;P&gt;hmmm... PEYTO PEYTO :))) I wish I can meme-it somehow &lt;span class="lia-unicode-emoji" title=":red_heart:"&gt;❤️&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="KristineDanielaShepherdson_0-1648698683288.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/37812iC2E7A22F2B4446B3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="KristineDanielaShepherdson_0-1648698683288.png" alt="KristineDanielaShepherdson_0-1648698683288.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Mar 2022 04:00:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-expression-too-long/m-p/1159748#M53479</guid>
      <dc:creator>Kristine-DanielaShepherdson</dc:creator>
      <dc:date>2022-03-31T04:00:23Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression too long</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-expression-too-long/m-p/1159749#M53480</link>
      <description>&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 31 Mar 2022 03:58:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-expression-too-long/m-p/1159749#M53480</guid>
      <dc:creator>Kristine-DanielaShepherdson</dc:creator>
      <dc:date>2022-03-31T03:58:24Z</dc:date>
    </item>
    <item>
      <title>Re: Arcade expression too long</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/arcade-expression-too-long/m-p/1159751#M53481</link>
      <description>&lt;P&gt;Oki. This one worked well too. Just needed a bit of tinkering:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;var name_parts = Split($feature.company, ' ')&lt;/P&gt;&lt;P&gt;if (Count(name_parts[0]) &amp;gt; 3){&lt;BR /&gt;return name_parts[0]&lt;BR /&gt;} else {&lt;BR /&gt;return `${name_parts[0]}\n${name_parts[1]}`+"\n"+$feature.disp_num}&lt;/P&gt;</description>
      <pubDate>Thu, 31 Mar 2022 04:07:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/arcade-expression-too-long/m-p/1159751#M53481</guid>
      <dc:creator>Kristine-DanielaShepherdson</dc:creator>
      <dc:date>2022-03-31T04:07:37Z</dc:date>
    </item>
  </channel>
</rss>

