<?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: Need conditional formatting to color labels based on value in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/need-conditional-formatting-to-color-labels-based/m-p/1504143#M85461</link>
    <description>&lt;P&gt;Do you mind if the date is colored also? Probably the easiest things to do would be to set up two label classes, one for each of the value ranges based on the test result:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ZachBodenner_0-1720706171801.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/109484iBA14B2BECC731AD8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ZachBodenner_0-1720706171801.png" alt="ZachBodenner_0-1720706171801.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My example above has two different label classes based on the size of the feature. Then in the label class, use the SQL tab to set the criteria based on the results value, and style accordingly&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ZachBodenner_1-1720706229994.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/109485iBCED26EAEBA00F5D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ZachBodenner_1-1720706229994.png" alt="ZachBodenner_1-1720706229994.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 11 Jul 2024 13:57:15 GMT</pubDate>
    <dc:creator>ZachBodenner</dc:creator>
    <dc:date>2024-07-11T13:57:15Z</dc:date>
    <item>
      <title>Need conditional formatting to color labels based on value</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/need-conditional-formatting-to-color-labels-based/m-p/1504135#M85459</link>
      <description>&lt;P&gt;I am working with monitoring well sample data and have test results labelled for April and June. But I also want to set a condition to output a red label if the value is 10 or higher. And I don't want the 'NS' labels colored, just the 10 or higher values. Here is what I am looking at.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="condform.png" style="width: 952px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/109483iB7D76FB18E5F7831/image-size/large?v=v2&amp;amp;px=999" role="button" title="condform.png" alt="condform.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jul 2024 13:41:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/need-conditional-formatting-to-color-labels-based/m-p/1504135#M85459</guid>
      <dc:creator>ECSFloridaECSLimited</dc:creator>
      <dc:date>2024-07-11T13:41:59Z</dc:date>
    </item>
    <item>
      <title>Re: Need conditional formatting to color labels based on value</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/need-conditional-formatting-to-color-labels-based/m-p/1504143#M85461</link>
      <description>&lt;P&gt;Do you mind if the date is colored also? Probably the easiest things to do would be to set up two label classes, one for each of the value ranges based on the test result:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ZachBodenner_0-1720706171801.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/109484iBA14B2BECC731AD8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ZachBodenner_0-1720706171801.png" alt="ZachBodenner_0-1720706171801.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My example above has two different label classes based on the size of the feature. Then in the label class, use the SQL tab to set the criteria based on the results value, and style accordingly&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ZachBodenner_1-1720706229994.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/109485iBCED26EAEBA00F5D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ZachBodenner_1-1720706229994.png" alt="ZachBodenner_1-1720706229994.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jul 2024 13:57:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/need-conditional-formatting-to-color-labels-based/m-p/1504143#M85461</guid>
      <dc:creator>ZachBodenner</dc:creator>
      <dc:date>2024-07-11T13:57:15Z</dc:date>
    </item>
    <item>
      <title>Re: Need conditional formatting to color labels based on value</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/need-conditional-formatting-to-color-labels-based/m-p/1504156#M85466</link>
      <description>&lt;P&gt;Dynamic labels in Pro are pretty limited, but conditionally changing colors is possible.&lt;/P&gt;&lt;P&gt;Since there are "NS" values, are those actually &lt;EM&gt;text&lt;/EM&gt; fields? I'll assume so for this post.&lt;/P&gt;&lt;P&gt;In text, what we're doing is&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;For each numeric field:&lt;OL&gt;&lt;LI&gt;Get the numeric value of the attribute&lt;/LI&gt;&lt;LI&gt;Compare against a threshold&lt;/LI&gt;&lt;LI&gt;Output "red" or "black" in a font element tag&lt;/LI&gt;&lt;/OL&gt;&lt;/LI&gt;&lt;LI&gt;Combine everything into a single text string&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Since we're doing a series of steps more than once, I'm going to use a custom function.&lt;/P&gt;&lt;P&gt;Here's what the code could look like:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;function colorCode(x) {
  // default color is black
  var col = 'red = "0"'
  // check for numeric value
  if (x != 'NS') {
    // convert to number
    x = Number(x)
    // greater than 10, color is red
    if (x &amp;gt;= 10) {
      col = 'red = "255"'
    }
  }
  // return text
  return `&amp;lt;CLR ${col}&amp;gt;${x}&amp;lt;/CLR&amp;gt;`
}

return `April: ${colorCode($feature['ArsTestApr'])}
June: ${colorCode($feature['ArsTestJun'])}`&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note, I haven't tested this in Pro. In other contexts, a literal line break in a `backtick string` will come through in the output, but I know Pro can be a little different in how it handles Arcade.&lt;/P&gt;&lt;P&gt;Here's me testing this with some made up values:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jcarlson_0-1720707195996.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/109488i9913E518DEF859CB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jcarlson_0-1720707195996.png" alt="jcarlson_0-1720707195996.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jcarlson_1-1720707220097.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/109489iB9EFFC339F13A98E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jcarlson_1-1720707220097.png" alt="jcarlson_1-1720707220097.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jul 2024 14:13:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/need-conditional-formatting-to-color-labels-based/m-p/1504156#M85466</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2024-07-11T14:13:53Z</dc:date>
    </item>
  </channel>
</rss>

