<?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 to set up Table Cell Highlighting with Different Conditions for each Column based on values in the First Column? in All Apps and Add-ons</title>
    <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-to-set-up-Table-Cell-Highlighting-with-Different-Conditions/m-p/223787#M24646</link>
    <description>&lt;P&gt;Thanks @kbarker302,&lt;/P&gt;

&lt;P&gt;This logic worked and i am able to get the result as i wanted.&lt;/P&gt;

&lt;P&gt;Many thanks!&lt;/P&gt;</description>
    <pubDate>Wed, 22 Jun 2016 09:38:48 GMT</pubDate>
    <dc:creator>ashish9433</dc:creator>
    <dc:date>2016-06-22T09:38:48Z</dc:date>
    <item>
      <title>How to set up Table Cell Highlighting with Different Conditions for each Column based on values in the First Column?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-to-set-up-Table-Cell-Highlighting-with-Different-Conditions/m-p/223785#M24644</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I am referring to Table Cell Highlighting example in Splunk 6.x dashboard and below is my requirement.&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/1500iC7509FD0E751D09C/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;I want to color cells of Column2, Column3 &amp;amp; Column4 based on the values of Column1 as below&lt;/P&gt;

&lt;P&gt;if the value of column1=string1&lt;BR /&gt;
    then for column2 ( &amp;lt;20 - Green, 21-50 - Red Colour &amp;amp; &amp;gt;51 - Amber Colour)&lt;BR /&gt;
    then for column3 ( &amp;lt;20 - Amber, 21-50 - Blue Colour &amp;amp; &amp;gt;51 - Green Colour)&lt;BR /&gt;
    then for column4 ( &amp;lt;50 - Green , &amp;gt;51- Red)&lt;/P&gt;

&lt;P&gt;if the value of column1=string2&lt;BR /&gt;
    then for column2 ( &amp;lt;20 - Red, 21-50 -Amber Colour &amp;amp; &amp;gt;51 - Green Colour)&lt;BR /&gt;
    then for column3 ( &amp;lt;20 - Green, 21-50 - Blue Colour &amp;amp; &amp;gt;51 - Red Colour)&lt;BR /&gt;
    then for column4 ( &amp;lt;50 - Red , &amp;gt;51- Green)&lt;/P&gt;

&lt;P&gt;and so on.&lt;/P&gt;

&lt;P&gt;I tried the below javascript, but it didn't work. Can any one help me to fix it?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;if (cell.field == "Column1") {
        if (cell.value == "String1" || cell.value == "String4" ) {
              if (cell.field == 'Column2' ) {
                    if (value &amp;lt;=20)
                           {
                             $td.addClass('Green');
                           }
                        if (value &amp;gt;=21 &amp;amp;&amp;amp; value &amp;lt;= 50  )
                           {
                             $td.addClass('Red');
                           }
                    if (value &amp;gt;=51 )
                           {
                                 $td.addClass('Amber');
                           }
                }

                   if (cell.field == 'Column3' ) {
                       if (value &amp;lt;=20)
                           {
                             $td.addClass('Amber');
                           }
                       if (value &amp;gt;=21 &amp;amp;&amp;amp; value &amp;lt;= 50  )
                           {
                                 $td.addClass('Blue');
                           }
                       if (value &amp;gt;=51)
                           {
                                    $td.addClass('Green');
                           }
                    }

                    if (cell.field == 'Column4' ) {
                       if (value &amp;lt;=50)
                           {
                             $td.addClass('Green');
                           }
                       if (value &amp;gt;=51 )
                           {
                                 $td.addClass('Red');
                           }
                    }
     }
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Basically i tried debugging the above javascript by putting alert statements, what i could find was it never enter the below loop statement in the above code.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;if (cell.field == 'Column2' ) {

if (cell.field == 'Column3' ) {

if (cell.field == 'Column4' ) {
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Can any one help me to find out how can i proceed to fix this scenario?&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jun 2016 15:38:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-to-set-up-Table-Cell-Highlighting-with-Different-Conditions/m-p/223785#M24644</guid>
      <dc:creator>ashish9433</dc:creator>
      <dc:date>2016-06-21T15:38:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to set up Table Cell Highlighting with Different Conditions for each Column based on values in the First Column?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-to-set-up-Table-Cell-Highlighting-with-Different-Conditions/m-p/223786#M24645</link>
      <description>&lt;P&gt;I believe you'll need to move your Column2/Column3/Column4 if statements outside of the Column1 if statement.  Then, in its place, set some indicator that indicates when to apply the styles.  &lt;/P&gt;

&lt;P&gt;The problem is that when cell.field equals "Column1", it can't be equal to Columns 2, 3, or 4 - at least not until the next iteration of the "loop".  You would need to do something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;var setClass = 'false';  // make this a global variable

if (cell.field == "Column1") {
    if (cell.value == "String1" || cell.value == "String4" ) {
       setClass = 'true';
    } else {
       setClass = 'false';
}

if (setClass == 'true') {
  if (cell.field == 'Column2' ) {

  if (cell.field == 'Column3' ) {

  if (cell.field == 'Column4' ) {
}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But I'm not sure if you'll be able to set a global variable from within your extension of TableView.BaseCellRenderer.  Also, I'm assuming that your complete JavaScript is following the example shown by user Flynt in this post:&lt;/P&gt;

&lt;P&gt;&lt;A href="https://answers.splunk.com/answers/230164/how-to-get-a-table-cell-color-to-change-depending.html"&gt;https://answers.splunk.com/answers/230164/how-to-get-a-table-cell-color-to-change-depending.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jun 2016 17:52:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-to-set-up-Table-Cell-Highlighting-with-Different-Conditions/m-p/223786#M24645</guid>
      <dc:creator>kbarker302</dc:creator>
      <dc:date>2016-06-21T17:52:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to set up Table Cell Highlighting with Different Conditions for each Column based on values in the First Column?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-to-set-up-Table-Cell-Highlighting-with-Different-Conditions/m-p/223787#M24646</link>
      <description>&lt;P&gt;Thanks @kbarker302,&lt;/P&gt;

&lt;P&gt;This logic worked and i am able to get the result as i wanted.&lt;/P&gt;

&lt;P&gt;Many thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jun 2016 09:38:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-to-set-up-Table-Cell-Highlighting-with-Different-Conditions/m-p/223787#M24646</guid>
      <dc:creator>ashish9433</dc:creator>
      <dc:date>2016-06-22T09:38:48Z</dc:date>
    </item>
  </channel>
</rss>

