<?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: Conditional label based on field value in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/conditional-label-based-on-field-value/m-p/1390101#M57820</link>
    <description>&lt;P&gt;This is a great reason to use Arcade. Here is some Arcade you can apply to your label settings. I have also added a text conversion to the DTI field so that if you do eventually change this to a numeric field it will still work.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var ia = $feature["IA_Cause"];
var dti = $feature["DTI"];
var label;

if (IsEmpty(dti) == false) {
  label = ia + " " + Text(dti) + "m";
} else {
  label = ia;
};

return label;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 04 Mar 2024 01:21:47 GMT</pubDate>
    <dc:creator>RoryMcPherson</dc:creator>
    <dc:date>2024-03-04T01:21:47Z</dc:date>
    <item>
      <title>Conditional label based on field value</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/conditional-label-based-on-field-value/m-p/1390098#M57819</link>
      <description>&lt;P&gt;On a Point layer, i want to create a label, where if certain attributes have been entered, Then add those aswell.&lt;BR /&gt;&lt;BR /&gt;2x relevant fields are:&lt;BR /&gt;&lt;BR /&gt;IA_Cause - A dropdown / Domain list containing text reasons for the point&lt;BR /&gt;DTI - Text field, But, Eventually will be updated to be numeric (to only allow XX.X numbers)&lt;/P&gt;&lt;P&gt;I would like the IA_Cause to be the default label for the points.&lt;BR /&gt;However, IF a value has been added to the "DTI" field, i would also like that added to the label.&lt;BR /&gt;And IF the DTI field has a value, i would like to add "m" to the end of the DTI Value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In an example, where a point without a DTI value added to the feature would just be labeled:&lt;BR /&gt;"Because of reasons"&lt;/P&gt;&lt;P&gt;In an example where the same point had "21.6" added to the DTI Attribute&lt;BR /&gt;"Because of reasons 21.6m"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I Currently use:&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;1. $feature&lt;/SPAN&gt;&lt;SPAN&gt;[&lt;/SPAN&gt;&lt;SPAN&gt;"IA_Cause"&lt;/SPAN&gt;&lt;SPAN&gt;]&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;2. DomainName&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;$feature&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;"IA_Cause"&lt;/SPAN&gt;&lt;SPAN&gt;) + &lt;/SPAN&gt;&lt;SPAN&gt;$feature&lt;/SPAN&gt;&lt;SPAN&gt;[&lt;/SPAN&gt;&lt;SPAN&gt;"DTI"&lt;/SPAN&gt;&lt;SPAN&gt;] + &lt;/SPAN&gt;&lt;SPAN&gt;"m"&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The issue with the formula is:&lt;BR /&gt;Where a point is added with ONLY the "IA_Cause" and NO DTI value, The label automatically adds an 'm' at the end, so i end up with a label saying "Because of reasonsm"&lt;/P&gt;</description>
      <pubDate>Mon, 04 Mar 2024 00:46:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/conditional-label-based-on-field-value/m-p/1390098#M57819</guid>
      <dc:creator>PipeVision</dc:creator>
      <dc:date>2024-03-04T00:46:55Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional label based on field value</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/conditional-label-based-on-field-value/m-p/1390101#M57820</link>
      <description>&lt;P&gt;This is a great reason to use Arcade. Here is some Arcade you can apply to your label settings. I have also added a text conversion to the DTI field so that if you do eventually change this to a numeric field it will still work.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var ia = $feature["IA_Cause"];
var dti = $feature["DTI"];
var label;

if (IsEmpty(dti) == false) {
  label = ia + " " + Text(dti) + "m";
} else {
  label = ia;
};

return label;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Mar 2024 01:21:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/conditional-label-based-on-field-value/m-p/1390101#M57820</guid>
      <dc:creator>RoryMcPherson</dc:creator>
      <dc:date>2024-03-04T01:21:47Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional label based on field value</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/conditional-label-based-on-field-value/m-p/1390122#M57822</link>
      <description>&lt;P&gt;Absolutely stunning! Thank you very much.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Mar 2024 03:53:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/conditional-label-based-on-field-value/m-p/1390122#M57822</guid>
      <dc:creator>PipeVision</dc:creator>
      <dc:date>2024-03-04T03:53:30Z</dc:date>
    </item>
  </channel>
</rss>

