<?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 Dashboard format: color a cell of a column (with no value) regarding the value of a cell of another column in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Dashboard-format-color-a-cell-of-a-column-with-no-value/m-p/491850#M32211</link>
    <description>&lt;P&gt;Hi all,&lt;BR /&gt;
I would like to have a dashboard with these 3 columns;&lt;BR /&gt;
1. Name of the "Country"&lt;BR /&gt;
2. "Status" column, which will not have any value but cells will have fill color according of the value of "Info" column&lt;BR /&gt;
          a) If Info column has "Batch has been executed with data" &amp;gt;&amp;gt; Fill color of the cell will be Green&lt;BR /&gt;
          b) If Info column has "Batch has been executed with no data" &amp;gt;&amp;gt;Fill color of the cell will be  Yellow&lt;BR /&gt;
          c) If Info column has "Batch has not  been executed" &amp;gt;&amp;gt; Fill color of the cell will be  Red&lt;BR /&gt;
3. "Info" column with three possibles values as describe above&lt;/P&gt;

&lt;P&gt;Column 1 and 3 are not a problem as they come from the data. But I am facing issues with the configuration of Status column.&lt;BR /&gt;
 I did some research in "Splunk answers" space and there are similar cases that propose using javascript and css file. I tried to adapt those codes but as I am not an expert on .js and .css i did not succeed.&lt;BR /&gt;&lt;BR /&gt;
I would really appreciate if someone can write the code of .js and .css for me.&lt;/P&gt;

&lt;P&gt;Thanks in advance for helping me, I did mi best but it was not possible. I don't really know if it could be possible at the end o I have other ways&lt;/P&gt;</description>
    <pubDate>Sat, 14 Mar 2020 12:36:50 GMT</pubDate>
    <dc:creator>jaimelopez</dc:creator>
    <dc:date>2020-03-14T12:36:50Z</dc:date>
    <item>
      <title>Dashboard format: color a cell of a column (with no value) regarding the value of a cell of another column</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Dashboard-format-color-a-cell-of-a-column-with-no-value/m-p/491850#M32211</link>
      <description>&lt;P&gt;Hi all,&lt;BR /&gt;
I would like to have a dashboard with these 3 columns;&lt;BR /&gt;
1. Name of the "Country"&lt;BR /&gt;
2. "Status" column, which will not have any value but cells will have fill color according of the value of "Info" column&lt;BR /&gt;
          a) If Info column has "Batch has been executed with data" &amp;gt;&amp;gt; Fill color of the cell will be Green&lt;BR /&gt;
          b) If Info column has "Batch has been executed with no data" &amp;gt;&amp;gt;Fill color of the cell will be  Yellow&lt;BR /&gt;
          c) If Info column has "Batch has not  been executed" &amp;gt;&amp;gt; Fill color of the cell will be  Red&lt;BR /&gt;
3. "Info" column with three possibles values as describe above&lt;/P&gt;

&lt;P&gt;Column 1 and 3 are not a problem as they come from the data. But I am facing issues with the configuration of Status column.&lt;BR /&gt;
 I did some research in "Splunk answers" space and there are similar cases that propose using javascript and css file. I tried to adapt those codes but as I am not an expert on .js and .css i did not succeed.&lt;BR /&gt;&lt;BR /&gt;
I would really appreciate if someone can write the code of .js and .css for me.&lt;/P&gt;

&lt;P&gt;Thanks in advance for helping me, I did mi best but it was not possible. I don't really know if it could be possible at the end o I have other ways&lt;/P&gt;</description>
      <pubDate>Sat, 14 Mar 2020 12:36:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Dashboard-format-color-a-cell-of-a-column-with-no-value/m-p/491850#M32211</guid>
      <dc:creator>jaimelopez</dc:creator>
      <dc:date>2020-03-14T12:36:50Z</dc:date>
    </item>
    <item>
      <title>Re: Dashboard format: color a cell of a column (with no value) regarding the value of a cell of another column</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Dashboard-format-color-a-cell-of-a-column-with-no-value/m-p/491851#M32212</link>
      <description>&lt;P&gt;hi @jaimelopez,&lt;/P&gt;

&lt;P&gt;Try this:&lt;BR /&gt;
color_cells.xml&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;dashboard script="customize_js.js" stylesheet="customize_css.css"&amp;gt;
  &amp;lt;label&amp;gt;Color cells&amp;lt;/label&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;table id="customize_table"&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;| makeresults 
| eval _raw="Country, Info
USA,Batch has been executed with data
India,Batch has been executed with no data
UK,Batch has not been executed" 
| multikv forceheader=1 
| eval Status=case(Info=="Batch has been executed with data", "green", Info=="Batch has been executed with no data", "yellow", 1==1, "red") 
| table Country, Status, Info
          &amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;-d&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
      &amp;lt;/table&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/dashboard&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;js code:&lt;/STRONG&gt;&lt;BR /&gt;
customize_js.js&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;require([ 'underscore', 'jquery', 'splunkjs/mvc', 'splunkjs/mvc/tableview',
        'splunkjs/mvc/simplexml/ready!' ], function(_, $, mvc, TableView) {

    var CustomRangeRenderer = TableView.BaseCellRenderer.extend({
        canRender : function(cell) {
            /* Only use the cell renderer for the Status field */
            return cell.field == 'Status';
        },
        render : function($td, cell) {
            var value = cell.value;
            if (value == 'green') {
                $td.addClass('css_green');
            }
            if (value == 'yellow') {
                $td.addClass('css_yellow');
            }
            if (value == 'red') {
                $td.addClass('css_red');
            }
            /* Set 'Status' value to '' */
            $td.text('');
        }
    });

    var table_component = mvc.Components.get("customize_table");
    table_component.getVisualization(function(tableView) {
        /* Register custom cell renderer, the table will re-render automatically */
        tableView.table.addCellRenderer(new CustomRangeRenderer());
        tableView.table.render();
    });
});
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;css code:&lt;/STRONG&gt;&lt;BR /&gt;
customize_css.css&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;/* Row Coloring */
td.css_green {
    background-color: #008000 !important;
}

td.css_yellow {
    background-color: #FFFF00 !important;
}

td.css_red {
    background-color: #FF0000 !important;
}
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 14 Mar 2020 16:42:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Dashboard-format-color-a-cell-of-a-column-with-no-value/m-p/491851#M32212</guid>
      <dc:creator>manjunathmeti</dc:creator>
      <dc:date>2020-03-14T16:42:31Z</dc:date>
    </item>
    <item>
      <title>Re: Dashboard format: color a cell of a column (with no value) regarding the value of a cell of another column</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Dashboard-format-color-a-cell-of-a-column-with-no-value/m-p/491852#M32213</link>
      <description>&lt;P&gt;Hi @manjunathmeti,&lt;BR /&gt;
It works &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;
Many thanks&lt;/P&gt;</description>
      <pubDate>Sun, 15 Mar 2020 12:22:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Dashboard-format-color-a-cell-of-a-column-with-no-value/m-p/491852#M32213</guid>
      <dc:creator>jaimelopez</dc:creator>
      <dc:date>2020-03-15T12:22:10Z</dc:date>
    </item>
    <item>
      <title>Re: Dashboard format: color a cell of a column (with no value) regarding the value of a cell of another column</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Dashboard-format-color-a-cell-of-a-column-with-no-value/m-p/505145#M33482</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/129090"&gt;@manjunathmeti&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Can you please help me with the javascript if i want to apply this for multiple columns.&lt;/P&gt;&lt;P&gt;Lets say, i have two columns Status &amp;amp; Old_status. I have to fill colours on both columns based on the value of cell.&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jun 2020 09:38:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Dashboard-format-color-a-cell-of-a-column-with-no-value/m-p/505145#M33482</guid>
      <dc:creator>harish_ka</dc:creator>
      <dc:date>2020-06-19T09:38:30Z</dc:date>
    </item>
    <item>
      <title>Re: Dashboard format: color a cell of a column (with no value) regarding the value of a cell of another column</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Dashboard-format-color-a-cell-of-a-column-with-no-value/m-p/505571#M33527</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/103806"&gt;@harish_ka&lt;/a&gt;&amp;nbsp;You can refer to one of my older answers to apply table cell color based on one field for multiple other fields (The example colors the entire row by applying color to all fields, but you can restrict to specific fields you want to color).&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;PS: The answer does not require Simple JS Extension &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.splunk.com/t5/Dashboards-Visualizations/How-to-change-font-color-based-on-a-condition-for-a-particular/td-p/487257" target="_blank"&gt;https://community.splunk.com/t5/Dashboards-Visualizations/How-to-change-font-color-based-on-a-condition-for-a-particular/td-p/487257&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Please try out and confirm and do up vote the answer if it works!&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jun 2020 18:10:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Dashboard-format-color-a-cell-of-a-column-with-no-value/m-p/505571#M33527</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2020-06-22T18:10:31Z</dc:date>
    </item>
  </channel>
</rss>

