<?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: Advanced/conditional formatting to change text color in list in ArcGIS Dashboards Questions</title>
    <link>https://community.esri.com/t5/arcgis-dashboards-questions/advanced-conditional-formatting-to-change-text/m-p/1577263#M10676</link>
    <description>&lt;P&gt;Thanks for this, jcarlson! Your comment saved my day!&lt;/P&gt;</description>
    <pubDate>Mon, 20 Jan 2025 17:58:03 GMT</pubDate>
    <dc:creator>Marylooh</dc:creator>
    <dc:date>2025-01-20T17:58:03Z</dc:date>
    <item>
      <title>Advanced/conditional formatting to change text color in list</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/advanced-conditional-formatting-to-change-text/m-p/1477729#M9638</link>
      <description>&lt;P&gt;I am trying to assign text color based on attributes for an event_type field. For some reason, it doesn't recognize the colors that are assigned. See anything that I am missing?&lt;/P&gt;&lt;LI-CODE lang="c"&gt;var eventColor = $datapoint.event_type

if(eventColor == 'Incident Activation'){
    return {textColor:'#ADFF8C'}
} else if(eventColor == 'Discussion-Based Exercise'){
    return {textColor:'#FFC379'}
} else if(eventColor == 'Operations-Based Exercise'){
    return {textColor:'#71C1FD'}
} else {
    return {textColor:'#FD7F7F'}
}

return {
  textColor: '',
  backgroundColor: '',
  separatorColor:'#adadad',
  selectionColor: '#fcfc86',
  selectionTextColor: '#fcfc86',
   // attributes: {
    // attribute1: '',
    // attribute2: ''
  // }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dwold_0-1716478609883.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/105143i4E702B70339EC74A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="dwold_0-1716478609883.png" alt="dwold_0-1716478609883.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dwold_1-1716478646693.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/105144i9F07FEAE990EC3E3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="dwold_1-1716478646693.png" alt="dwold_1-1716478646693.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/363906"&gt;@jcarlson&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/160974"&gt;@JenniferAcunto&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 May 2024 15:44:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/advanced-conditional-formatting-to-change-text/m-p/1477729#M9638</guid>
      <dc:creator>dwold</dc:creator>
      <dc:date>2024-05-23T15:44:48Z</dc:date>
    </item>
    <item>
      <title>Re: Advanced/conditional formatting to change text color in list</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/advanced-conditional-formatting-to-change-text/m-p/1477738#M9639</link>
      <description>&lt;P&gt;You have to set a variable to use with textColor. Also, Decode is a good replacement for if...else statements like this.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var color = Decode($datapoint.event_type, 'Incident Activation', '#ADFF8C',
                                          'Discussion-Based Exercise', '#FFC379',
                                          'Operations-Based Exercise', '#71C1FD',
                                          '#FD7F7F')
return {
  textColor: color,
  backgroundColor: '',
  separatorColor:'#adadad',
  selectionColor: '#fcfc86',
  selectionTextColor: '#fcfc86',
   // attributes: {
    // attribute1: '',
    // attribute2: ''
  // }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 May 2024 15:51:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/advanced-conditional-formatting-to-change-text/m-p/1477738#M9639</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2024-05-23T15:51:19Z</dc:date>
    </item>
    <item>
      <title>Re: Advanced/conditional formatting to change text color in list</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/advanced-conditional-formatting-to-change-text/m-p/1477760#M9641</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/2839"&gt;@KenBuja&lt;/a&gt;&amp;nbsp;thanks for looking at this! Using decode I am still getting a similar result with them all having the same text color&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dwold_0-1716480279137.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/105150iAE491018E295A6E8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="dwold_0-1716480279137.png" alt="dwold_0-1716480279137.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 May 2024 16:04:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/advanced-conditional-formatting-to-change-text/m-p/1477760#M9641</guid>
      <dc:creator>dwold</dc:creator>
      <dc:date>2024-05-23T16:04:52Z</dc:date>
    </item>
    <item>
      <title>Re: Advanced/conditional formatting to change text color in list</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/advanced-conditional-formatting-to-change-text/m-p/1477784#M9643</link>
      <description>&lt;P&gt;I'm using the same code and am getting the different colors as expected.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Snag_db64bb.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/105154i967993BC97CDEC8A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Snag_db64bb.png" alt="Snag_db64bb.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Does your field use a Domain? If so, you'll have to get the DomainName to use in the Decode&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var color = Decode(DomainName($datapoint, 'event_type'),&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 May 2024 16:29:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/advanced-conditional-formatting-to-change-text/m-p/1477784#M9643</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2024-05-23T16:29:17Z</dc:date>
    </item>
    <item>
      <title>Re: Advanced/conditional formatting to change text color in list</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/advanced-conditional-formatting-to-change-text/m-p/1477791#M9644</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/2839"&gt;@KenBuja&lt;/a&gt;&amp;nbsp;that was it. I needed to use the DomainName. Thank you for your help, much appreciated!!&lt;/P&gt;</description>
      <pubDate>Thu, 23 May 2024 16:33:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/advanced-conditional-formatting-to-change-text/m-p/1477791#M9644</guid>
      <dc:creator>dwold</dc:creator>
      <dc:date>2024-05-23T16:33:32Z</dc:date>
    </item>
    <item>
      <title>Re: Advanced/conditional formatting to change text color in list</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/advanced-conditional-formatting-to-change-text/m-p/1477822#M9646</link>
      <description>&lt;P&gt;Using the &lt;STRONG&gt;textColor &lt;/STRONG&gt;key in advanced formatting is only useful when you want &lt;EM&gt;all &lt;/EM&gt;the text to change, but it looks like you're applying different text colors to different parts of the list item template.&lt;/P&gt;&lt;P&gt;Include your color variable in the attributes section, then they can be referenced when you look at the template's source. Have your return object like this:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;return {
  separatorColor:'#adadad',
  selectionColor: '#fcfc86',
  selectionTextColor: '#fcfc86',
  attributes: {
    color
  }
}&lt;/LI-CODE&gt;&lt;P&gt;In a dictionary, if the key name and the variable are the same, like &lt;STRONG&gt;{color: color}&lt;/STRONG&gt;, you can reference it once.&lt;/P&gt;&lt;P&gt;Then if you view the source on your template, find the &amp;lt;div&amp;gt; or &amp;lt;p&amp;gt; element that contains the event name (I'm assuming that's what you want colored?) and add some inline styling.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;p style="color:{expression/color}"&amp;gt;{field/event_name}&amp;lt;/p&amp;gt;&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 23 May 2024 17:00:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/advanced-conditional-formatting-to-change-text/m-p/1477822#M9646</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2024-05-23T17:00:55Z</dc:date>
    </item>
    <item>
      <title>Re: Advanced/conditional formatting to change text color in list</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/advanced-conditional-formatting-to-change-text/m-p/1577263#M10676</link>
      <description>&lt;P&gt;Thanks for this, jcarlson! Your comment saved my day!&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jan 2025 17:58:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/advanced-conditional-formatting-to-change-text/m-p/1577263#M10676</guid>
      <dc:creator>Marylooh</dc:creator>
      <dc:date>2025-01-20T17:58:03Z</dc:date>
    </item>
  </channel>
</rss>

