<?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: How can I create color Tables based on Dynamic Values in Splunk 7? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-create-color-Tables-based-on-Dynamic-Values-in-Splunk/m-p/294965#M89020</link>
    <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;Thanks for this. I will give it a go next week to see if it works. God moved onto something else this week.&lt;/P&gt;

&lt;P&gt;Cheers&lt;/P&gt;</description>
    <pubDate>Fri, 23 Feb 2018 07:29:06 GMT</pubDate>
    <dc:creator>robertlynch2020</dc:creator>
    <dc:date>2018-02-23T07:29:06Z</dc:date>
    <item>
      <title>How can I create color Tables based on Dynamic Values in Splunk 7?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-create-color-Tables-based-on-Dynamic-Values-in-Splunk/m-p/294962#M89017</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;I have the following data&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;column_A column_B
10              20
15              5
16              100
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want to add logic, if column B &amp;gt; column A the cell goes red if not go green.&lt;BR /&gt;
I have tried $result.column_B$ &amp;gt; $result.column_B$ in the but no luck&lt;/P&gt;

&lt;P&gt;any ideas?&lt;BR /&gt;
Cheers in advance &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 18:07:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-create-color-Tables-based-on-Dynamic-Values-in-Splunk/m-p/294962#M89017</guid>
      <dc:creator>robertlynch2020</dc:creator>
      <dc:date>2020-09-29T18:07:27Z</dc:date>
    </item>
    <item>
      <title>Re: How can I create color Tables based on Dynamic Values in Splunk 7?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-create-color-Tables-based-on-Dynamic-Values-in-Splunk/m-p/294963#M89018</link>
      <description>&lt;P&gt;Hi @robertlynch2020,&lt;/P&gt;

&lt;P&gt;Can you please try this?&lt;/P&gt;

&lt;P&gt;Change searc hquesry and css as per you requirement.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;dashboard script="summary.js" stylesheet="summary.css"&amp;gt;
  &amp;lt;label&amp;gt;Color IN table&amp;lt;/label&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;table id="my_table"&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;| makeresults | eval column_A="10", column_B="20" | append [| makeresults | eval column_A="15", column_B="5" ] | append [| makeresults | eval column_A="16", column_B="200" ]| eval Your_logic="Just Comments" | eval column1=column_A."|".column_B,column2=column_A."|".column_B | table column1 column2&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;-24h@h&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="count"&amp;gt;2&amp;lt;/option&amp;gt;
        &amp;lt;option name="drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="refresh.display"&amp;gt;progressbar&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;summary.css&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;.circle_green { 
padding:10px 9px;
border:0px solid #a1a1a1;
background-color:rgb(7,245,7);
}
.circle_yellow { 
padding:10px 9px;
border:0px solid #a1a1a1;
background-color:rgb(245,245,0);
}
.circle_red { 
padding:10px 9px;
border:0px solid #a1a1a1;
background-color:rgb(245,7,7);
}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;summary.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) {
                return _(['column1','column2']).contains(cell.field);
            },
            render: function($td, cell) {
                var column1=cell.value.split("|")[0];
                var column2=cell.value.split("|")[1];
                var value="";
                if(cell.field=="column1")
                {
                    value=column1;
                }
                else 
                {
                    value=column1;
                }
                if( Number(column2) &amp;gt; Number(column1))
                {
                    $td.html("&amp;lt;div class='circle_red'&amp;gt;"+value+"&amp;lt;/div&amp;gt;")
                } else 
                {
                    $td.html("&amp;lt;div class='circle_green'&amp;gt;"+value+"&amp;lt;/div&amp;gt;")
                }
            }
        });
        //List of table IDs to add icon
        var tableIDs = ["my_table"];
        for (i=0;i&amp;lt;tableIDs.length;i++) {
            var sh = mvc.Components.get(tableIDs[i]);
            if(typeof(sh)!="undefined") {
                sh.getVisualization(function(tableView) {
                    // Add custom cell renderer and force re-render
                    tableView.table.addCellRenderer(new CustomRangeRenderer());
                    tableView.table.render();
                });
            }
        }    
    });
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 16 Feb 2018 05:21:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-create-color-Tables-based-on-Dynamic-Values-in-Splunk/m-p/294963#M89018</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2018-02-16T05:21:59Z</dc:date>
    </item>
    <item>
      <title>Re: How can I create color Tables based on Dynamic Values in Splunk 7?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-create-color-Tables-based-on-Dynamic-Values-in-Splunk/m-p/294964#M89019</link>
      <description>&lt;P&gt;Hi @robertlynch2020,&lt;BR /&gt;
Have you tried this ?&lt;/P&gt;</description>
      <pubDate>Fri, 23 Feb 2018 06:59:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-create-color-Tables-based-on-Dynamic-Values-in-Splunk/m-p/294964#M89019</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2018-02-23T06:59:55Z</dc:date>
    </item>
    <item>
      <title>Re: How can I create color Tables based on Dynamic Values in Splunk 7?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-create-color-Tables-based-on-Dynamic-Values-in-Splunk/m-p/294965#M89020</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;Thanks for this. I will give it a go next week to see if it works. God moved onto something else this week.&lt;/P&gt;

&lt;P&gt;Cheers&lt;/P&gt;</description>
      <pubDate>Fri, 23 Feb 2018 07:29:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-create-color-Tables-based-on-Dynamic-Values-in-Splunk/m-p/294965#M89020</guid>
      <dc:creator>robertlynch2020</dc:creator>
      <dc:date>2018-02-23T07:29:06Z</dc:date>
    </item>
  </channel>
</rss>

