<?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 Advanced Formatting List in ArcGIS Dashboards Questions</title>
    <link>https://community.esri.com/t5/arcgis-dashboards-questions/advanced-formatting-list/m-p/1535903#M10258</link>
    <description>&lt;P&gt;Hello out there! Looking for some guidance and hints on how to format a list. Specifically I'm looking to evaluate 5 different fields and then color the text for that line item based on the value. Where I get hung up is trying to evaluate more than 1 field and then applying to color to only that field in the line item layout. I Don't want all text to be a color just the value from that field, if that makes sense.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Seems like a long If then statement but I can't wrap my head around the structure.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a 5 fields for completion that has an integer between 0 and 100 and null.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my list I have each of these five fields as well as some other fields and text.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hoping to color the text for the field if 0-33 = red, 34 - 66 = yellow and 67 - 99 = green, all else black.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;var &lt;/SPAN&gt;&lt;SPAN&gt;comp1&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;$datapoint&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;pc_1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;var &lt;/SPAN&gt;&lt;SPAN&gt;comp2&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;$datapoint&lt;/SPAN&gt;&lt;SPAN&gt;.pc_2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;var comp3&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;= &lt;/SPAN&gt;&lt;SPAN&gt;$datapoint&lt;/SPAN&gt;&lt;SPAN&gt;.pc_3&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;var &lt;/SPAN&gt;&lt;SPAN&gt;comp4&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;= &lt;/SPAN&gt;&lt;SPAN&gt;$datapoint&lt;/SPAN&gt;&lt;SPAN&gt;.pc_4&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;var comp5&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;= &lt;/SPAN&gt;&lt;SPAN&gt;$datapoint&lt;/SPAN&gt;&lt;SPAN&gt;.pc_5&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 06 Sep 2024 13:46:50 GMT</pubDate>
    <dc:creator>BugPie</dc:creator>
    <dc:date>2024-09-06T13:46:50Z</dc:date>
    <item>
      <title>Advanced Formatting List</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/advanced-formatting-list/m-p/1535903#M10258</link>
      <description>&lt;P&gt;Hello out there! Looking for some guidance and hints on how to format a list. Specifically I'm looking to evaluate 5 different fields and then color the text for that line item based on the value. Where I get hung up is trying to evaluate more than 1 field and then applying to color to only that field in the line item layout. I Don't want all text to be a color just the value from that field, if that makes sense.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Seems like a long If then statement but I can't wrap my head around the structure.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a 5 fields for completion that has an integer between 0 and 100 and null.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my list I have each of these five fields as well as some other fields and text.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hoping to color the text for the field if 0-33 = red, 34 - 66 = yellow and 67 - 99 = green, all else black.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;var &lt;/SPAN&gt;&lt;SPAN&gt;comp1&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;$datapoint&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;pc_1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;var &lt;/SPAN&gt;&lt;SPAN&gt;comp2&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;$datapoint&lt;/SPAN&gt;&lt;SPAN&gt;.pc_2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;var comp3&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;= &lt;/SPAN&gt;&lt;SPAN&gt;$datapoint&lt;/SPAN&gt;&lt;SPAN&gt;.pc_3&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;var &lt;/SPAN&gt;&lt;SPAN&gt;comp4&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;= &lt;/SPAN&gt;&lt;SPAN&gt;$datapoint&lt;/SPAN&gt;&lt;SPAN&gt;.pc_4&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;var comp5&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;= &lt;/SPAN&gt;&lt;SPAN&gt;$datapoint&lt;/SPAN&gt;&lt;SPAN&gt;.pc_5&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Sep 2024 13:46:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/advanced-formatting-list/m-p/1535903#M10258</guid>
      <dc:creator>BugPie</dc:creator>
      <dc:date>2024-09-06T13:46:50Z</dc:date>
    </item>
    <item>
      <title>Re: Advanced Formatting List</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/advanced-formatting-list/m-p/1535950#M10259</link>
      <description>&lt;P&gt;To get single lines to be colored differently, you'll need to use inline styling. Since you're doing the same color scaling to each field, this would be a good spot for a custom function:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;function colorize(x) {
  var col = When(
    x &amp;lt; 34, 'red',
    x &amp;lt; 67, 'yellow',
    x &amp;lt; 100, 'green',
    'black'
  )

  return `&amp;lt;span style="color:${col}"&amp;gt;${x}&amp;lt;/span&amp;gt;`
}

return {
  attributes: {
    comp1: colorize($datapoint['comp1']),
    comp2: colorize($datapoint['comp2']),
    comp3: colorize($datapoint['comp3']),
    comp4: colorize($datapoint['comp4']),
    comp5: colorize($datapoint['comp5'])
  }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then in your line item template, bring the colorized text in "{expression/comp1}", etc.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Sep 2024 15:29:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/advanced-formatting-list/m-p/1535950#M10259</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2024-09-06T15:29:18Z</dc:date>
    </item>
    <item>
      <title>Re: Advanced Formatting List</title>
      <link>https://community.esri.com/t5/arcgis-dashboards-questions/advanced-formatting-list/m-p/1536537#M10263</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/363906"&gt;@jcarlson&lt;/a&gt;&amp;nbsp;I forgot about using &lt;SPAN&gt;"{expression/comp1}" as a way to call colorized text from the function. I need to take better notes from each of my projects but at least I'm getting better every time though. haha.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Sep 2024 18:02:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-dashboards-questions/advanced-formatting-list/m-p/1536537#M10263</guid>
      <dc:creator>BugPie</dc:creator>
      <dc:date>2024-09-09T18:02:17Z</dc:date>
    </item>
  </channel>
</rss>

