<?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: Color for text value in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Color-for-text-value/m-p/496937#M32525</link>
    <description>&lt;P&gt;@janitka There's lots of comparison operators and navigating which does what can be difficult. Especially since there can often be more than one way to get to an answer. However, you did the right thing and asking for opinions on Splunk Answers.&lt;BR /&gt;
Use this run anywhere example to see that I can take the text you have given and created an example that results in a Maintenance column with ON and OFF values.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval _raw="MachineID,MachineName,MaintenanceMode
  1,Yoda,True
  2,Dooku,True
  3,Jinn,True
  4,Kenobi,False
  5,Skywalker,False
  6,Tano,False" 
| multikv 
| table MachineName MaintenanceMode
| eval State=case(
     match(MaintenanceMode,"True"), "ON",
     match(MaintenanceMode,"False"), "OFF"
     )
| rename State AS Maintenance
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Here I am using a &lt;CODE&gt;case&lt;/CODE&gt; statement to evaluate more than one case (or situation). Then I use the &lt;CODE&gt;match&lt;/CODE&gt; function on the MaintenanceMode field, match on the word "True" and if it matches, call it "ON".&lt;BR /&gt;
For me, there's a lot of power in using case and eval functions. I reference the following doc a lot when I get stuck:&lt;BR /&gt;
&lt;A href="https://docs.splunk.com/Documentation/Splunk/Latest/SearchReference/CommonEvalFunctions"&gt;https://docs.splunk.com/Documentation/Splunk/Latest/SearchReference/CommonEvalFunctions&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Here are some screenshots of selecting colors based on text values. One is after you click the pencil/art brush in the top of the column, and the other is the result.&lt;BR /&gt;
&lt;A href="https://imgur.com/HTd182q"&gt;https://imgur.com/HTd182q&lt;/A&gt;&lt;BR /&gt;
&lt;A href="https://imgur.com/WfbZ0zL"&gt;https://imgur.com/WfbZ0zL&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 28 Jan 2020 17:32:46 GMT</pubDate>
    <dc:creator>efavreau</dc:creator>
    <dc:date>2020-01-28T17:32:46Z</dc:date>
    <item>
      <title>Color for text value</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Color-for-text-value/m-p/496936#M32524</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;could someone help what to modify in bellow search, as i want to display red/green color if the value is True or False&lt;/P&gt;

&lt;P&gt;sourcetype="xendesktop:7:machine"  MachineName="$MachineName$" | table InMaintenanceMode | rename InMaintenanceMode as Maintenance  | replace False with OFF in Maintenance | replace True with ON in Maintenance&lt;/P&gt;

&lt;P&gt;Why is there no option for text, same as for numerical values?&lt;/P&gt;

&lt;P&gt;Regards,&lt;BR /&gt;
Jan &lt;/P&gt;</description>
      <pubDate>Tue, 28 Jan 2020 12:50:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Color-for-text-value/m-p/496936#M32524</guid>
      <dc:creator>janitka</dc:creator>
      <dc:date>2020-01-28T12:50:41Z</dc:date>
    </item>
    <item>
      <title>Re: Color for text value</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Color-for-text-value/m-p/496937#M32525</link>
      <description>&lt;P&gt;@janitka There's lots of comparison operators and navigating which does what can be difficult. Especially since there can often be more than one way to get to an answer. However, you did the right thing and asking for opinions on Splunk Answers.&lt;BR /&gt;
Use this run anywhere example to see that I can take the text you have given and created an example that results in a Maintenance column with ON and OFF values.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval _raw="MachineID,MachineName,MaintenanceMode
  1,Yoda,True
  2,Dooku,True
  3,Jinn,True
  4,Kenobi,False
  5,Skywalker,False
  6,Tano,False" 
| multikv 
| table MachineName MaintenanceMode
| eval State=case(
     match(MaintenanceMode,"True"), "ON",
     match(MaintenanceMode,"False"), "OFF"
     )
| rename State AS Maintenance
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Here I am using a &lt;CODE&gt;case&lt;/CODE&gt; statement to evaluate more than one case (or situation). Then I use the &lt;CODE&gt;match&lt;/CODE&gt; function on the MaintenanceMode field, match on the word "True" and if it matches, call it "ON".&lt;BR /&gt;
For me, there's a lot of power in using case and eval functions. I reference the following doc a lot when I get stuck:&lt;BR /&gt;
&lt;A href="https://docs.splunk.com/Documentation/Splunk/Latest/SearchReference/CommonEvalFunctions"&gt;https://docs.splunk.com/Documentation/Splunk/Latest/SearchReference/CommonEvalFunctions&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Here are some screenshots of selecting colors based on text values. One is after you click the pencil/art brush in the top of the column, and the other is the result.&lt;BR /&gt;
&lt;A href="https://imgur.com/HTd182q"&gt;https://imgur.com/HTd182q&lt;/A&gt;&lt;BR /&gt;
&lt;A href="https://imgur.com/WfbZ0zL"&gt;https://imgur.com/WfbZ0zL&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jan 2020 17:32:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Color-for-text-value/m-p/496937#M32525</guid>
      <dc:creator>efavreau</dc:creator>
      <dc:date>2020-01-28T17:32:46Z</dc:date>
    </item>
  </channel>
</rss>

