<?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: Add colors to a table for dynamic columns in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-colors-to-a-table-for-dynamic-columns/m-p/411428#M118684</link>
    <description>&lt;P&gt;I am not sure why xyseries would not work. How about trying the following?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| table TAG *
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hope your issue gets resolved. If the comments have helped do upvote answer/comment &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 20 Jan 2019 17:21:53 GMT</pubDate>
    <dc:creator>niketn</dc:creator>
    <dc:date>2019-01-20T17:21:53Z</dc:date>
    <item>
      <title>How to add colors to a table for dynamic columns?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-colors-to-a-table-for-dynamic-columns/m-p/411419#M118675</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;I am producing a table with time as the column header. However i can only use hour not the full date as i have to hard code it for the color to take effect.&lt;/P&gt;
&lt;P&gt;How can i make this dynamic so i can add date or use wild characters ?&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/6394i5EB73BE1BCB1ECB1/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;Example of the code i have written, very long and not great to look at.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt; &amp;lt;format type="color" field="00:00:00"&amp;gt;
          &amp;lt;colorPalette type="list"&amp;gt;[#6DB7C6,#F7BC38,#D93F3C]&amp;lt;/colorPalette&amp;gt;
          &amp;lt;scale type="threshold"&amp;gt;1,5&amp;lt;/scale&amp;gt;
        &amp;lt;/format&amp;gt;
        &amp;lt;format type="color" field="01:00:00"&amp;gt;
          &amp;lt;colorPalette type="list"&amp;gt;[#6DB7C6,#F7BC38,#D93F3C]&amp;lt;/colorPalette&amp;gt;
          &amp;lt;scale type="threshold"&amp;gt;1,5&amp;lt;/scale&amp;gt;
        &amp;lt;/format&amp;gt;
        &amp;lt;format type="color" field="02:00:00"&amp;gt;
          &amp;lt;colorPalette type="list"&amp;gt;[#6DB7C6,#F7BC38,#D93F3C]&amp;lt;/colorPalette&amp;gt;
          &amp;lt;scale type="threshold"&amp;gt;1,5&amp;lt;/scale&amp;gt;
        &amp;lt;/format&amp;gt;
        &amp;lt;format type="color" field="03:00:00"&amp;gt;
          &amp;lt;colorPalette type="list"&amp;gt;[#6DB7C6,#F7BC38,#D93F3C]&amp;lt;/colorPalette&amp;gt;
          &amp;lt;scale type="threshold"&amp;gt;1,5&amp;lt;/scale&amp;gt;
        &amp;lt;/format&amp;gt;
        &amp;lt;format type="color" field="04:00:00"&amp;gt;
          &amp;lt;colorPalette type="list"&amp;gt;[#6DB7C6,#F7BC38,#D93F3C]&amp;lt;/colorPalette&amp;gt;
          &amp;lt;scale type="threshold"&amp;gt;1,5&amp;lt;/scale&amp;gt;
        &amp;lt;/format&amp;gt;
        &amp;lt;format type="color" field="05:00:00"&amp;gt;
          &amp;lt;colorPalette type="list"&amp;gt;[#6DB7C6,#F7BC38,#D93F3C]&amp;lt;/colorPalette&amp;gt;
          &amp;lt;scale type="threshold"&amp;gt;1,5&amp;lt;/scale&amp;gt;
        &amp;lt;/format&amp;gt;
        &amp;lt;format type="color" field="06:00:00"&amp;gt;
          &amp;lt;colorPalette type="list"&amp;gt;[#6DB7C6,#F7BC38,#D93F3C]&amp;lt;/colorPalette&amp;gt;
          &amp;lt;scale type="threshold"&amp;gt;1,5&amp;lt;/scale&amp;gt;
        &amp;lt;/format&amp;gt;
        &amp;lt;format type="color" field="07:00:00"&amp;gt;
          &amp;lt;colorPalette type="list"&amp;gt;[#6DB7C6,#F7BC38,#D93F3C]&amp;lt;/colorPalette&amp;gt;
          &amp;lt;scale type="threshold"&amp;gt;1,5&amp;lt;/scale&amp;gt;
        &amp;lt;/format&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Thanks in Advance&lt;BR /&gt;Robert&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jul 2022 13:57:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-colors-to-a-table-for-dynamic-columns/m-p/411419#M118675</guid>
      <dc:creator>robertlynch2020</dc:creator>
      <dc:date>2022-07-27T13:57:45Z</dc:date>
    </item>
    <item>
      <title>Re: Add colors to a table for dynamic columns</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-colors-to-a-table-for-dynamic-columns/m-p/411420#M118676</link>
      <description>&lt;P&gt;@robertlynch2020 refer to one of my older answers where based on Search results Dynamic color can be applied to all fields using Simple XML JS Extension and Splunk JS Stack: &lt;A href="https://answers.splunk.com/answers/618930/how-can-i-get-the-table-cell-colorization-renderin-1.html"&gt;https://answers.splunk.com/answers/618930/how-can-i-get-the-table-cell-colorization-renderin-1.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;In the example it excludes _time from applying color. In your case it will be the TAG field which will not have color applied.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jan 2019 14:09:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-colors-to-a-table-for-dynamic-columns/m-p/411420#M118676</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2019-01-17T14:09:00Z</dc:date>
    </item>
    <item>
      <title>Re: Add colors to a table for dynamic columns</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-colors-to-a-table-for-dynamic-columns/m-p/411421#M118677</link>
      <description>&lt;P&gt;Great and thanks&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jan 2019 14:54:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-colors-to-a-table-for-dynamic-columns/m-p/411421#M118677</guid>
      <dc:creator>robertlynch2020</dc:creator>
      <dc:date>2019-01-17T14:54:17Z</dc:date>
    </item>
    <item>
      <title>Re: Add colors to a table for dynamic columns</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-colors-to-a-table-for-dynamic-columns/m-p/411422#M118678</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;Thanks for the replay, however i am having issues getting it to work without _time in the javascript.&lt;BR /&gt;
I have replaced _time with TAG, but i get NaN for the values.&lt;/P&gt;

&lt;P&gt;An ideas?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;require([
     "underscore",
     "jquery",
     "splunkjs/mvc",
     "splunkjs/mvc/searchmanager",
     "splunkjs/mvc/tableview",
     "splunkjs/mvc/simplexml/ready!"
 ], function(_, $, mvc, SearchManager, TableView) {

     var mySearch = splunkjs.mvc.Components.getInstance("myTableSearch");
     var myResults = mySearch.data("results", {count:0});
     var allFields,filteredFields;
     myResults.on("data", function(){
         allFields=myResults.data().fields;
         filteredFields=allFields.filter(filterFields);
         console.log("Filtered Fields:",filteredFields);
     });
     function filterFields(field) {
         return field !== "TAG";
     }
     // Row Coloring Example with custom, client-side range interpretation
     var CustomRangeRenderer = TableView.BaseCellRenderer.extend({
         canRender: function(cell) {
             // Enable this custom cell renderer for all fields except TAG
             return _(filteredFields).contains(cell.field);
         },
         render: function($td, cell) {
             // Add a class to the cell based on the returned value
             var value = parseInt(cell.value);

             // Apply interpretation based on count of errors per TAG for each field
             if(cell.field !== "TAG"){
                 if (value &amp;gt;= 5) {
                     $td.addClass("range-cell").addClass("range-severe");
                 }
                 else if (value &amp;gt;= 1 &amp;amp;&amp;amp; value &amp;lt; 5) {
                     $td.addClass("range-cell").addClass("range-elevated");
                 }
                 else if (value &amp;lt; 1) {
                     $td.addClass("range-cell").addClass("range-low");
                 }
                 // Update the cell content
                 $td.text(value).addClass("numeric");
             }
         }
     });
     mvc.Components.get("highlight").getVisualization(function(tableView) {
         // Add custom cell renderer, the table will re-render automatically.
         tableView.addCellRenderer(new CustomRangeRenderer());
     });

 });
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;For record this is the full code i am running&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  &amp;lt;row&amp;gt;
    &amp;lt;panel depends="$alaysHideCSS$"&amp;gt;
      &amp;lt;html&amp;gt;
         &amp;lt;style&amp;gt;
           #highlight td {
               background-color: #c1ffc3 !important;
           }
           */
           #highlight td.range-low {
               color: #C0D9D9;
           }
           #highlight td.range-elevated {
               background-color: #ffc57a !important;
               font-weight: bold;
           }
           #highlight td.range-severe {
               background-color: #d59392 !important;
               font-weight: bold;
           }          
         &amp;lt;/style&amp;gt;
       &amp;lt;/html&amp;gt;
    &amp;lt;/panel&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;table id="highlight"&amp;gt;
        &amp;lt;search id="myTableSearch"&amp;gt;
          &amp;lt;query&amp;gt;| tstats summariesonly=true values(All_TPS_Logs.duration) AS Duration max(All_TPS_Logs.duration) AS All_TPS_Logs.duration FROM datamodel=TPS_V5 WHERE (nodename=All_TPS_Logs host=LUAS_2019_01_01 All_TPS_Logs.duration &amp;amp;lt;= 1000000000000 All_TPS_Logs.duration &amp;amp;gt;= -10000000 (All_TPS_Logs.user=* OR NOT All_TPS_Logs.user=*) All_TPS_Logs.operationIdentity="*") All_TPS_Logs.name =*** GROUPBY _time, All_TPS_Logs.fullyQualifiedMethod span=1s 
    | rename All_TPS_Logs.fullyQualifiedMethod as series 
    | rename All_TPS_Logs.duration as value 
    | table _time series value 
    | search (series=**murex**) 
    | lookup TPS_TAGS_HIGH_LEVEL Method#Class AS "series" OUTPUT TAG Threshold 
    | where value &amp;amp;gt; Threshold 
    | fillnull Threshold 
    | fillnull TAG 
    | eval TAG=if(TAG=0,"PLEASE_ADD_TAG",TAG) 
     | search NOT TAG = "PLEASE_ADD_TAG"
| timechart span=1h count(value) by TAG 
| untable _time TAG value 
| eval c_time=strftime(_time,"%T") 
| xyseries TAG c_time value | rename TAG as _time&amp;lt;/query&amp;gt;
            &amp;lt;earliest&amp;gt;$time_token.earliest$&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;$time_token.latest$&amp;lt;/latest&amp;gt;
          &amp;lt;sampleRatio&amp;gt;1&amp;lt;/sampleRatio&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="count"&amp;gt;20&amp;lt;/option&amp;gt;
        &amp;lt;option name="dataOverlayMode"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="percentagesRow"&amp;gt;false&amp;lt;/option&amp;gt;
        &amp;lt;option name="rowNumbers"&amp;gt;false&amp;lt;/option&amp;gt;
        &amp;lt;option name="totalsRow"&amp;gt;false&amp;lt;/option&amp;gt;
        &amp;lt;option name="wrap"&amp;gt;true&amp;lt;/option&amp;gt;
      &amp;lt;/table&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 18 Jan 2019 12:38:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-colors-to-a-table-for-dynamic-columns/m-p/411422#M118678</guid>
      <dc:creator>robertlynch2020</dc:creator>
      <dc:date>2019-01-18T12:38:40Z</dc:date>
    </item>
    <item>
      <title>Re: Add colors to a table for dynamic columns</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-colors-to-a-table-for-dynamic-columns/m-p/411423#M118679</link>
      <description>&lt;P&gt;@robertlynch2020 Based on the Screenshot you had attached in the question your TAG field had text. I am not sure why in your SPL you are performing &lt;CODE&gt;| rename TAG as _time&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Having said that in the Tabular view without the JS ensure that all Field values are populated. Using &lt;CODE&gt;eval&lt;/CODE&gt; or &lt;CODE&gt;fillnull&lt;/CODE&gt;. If not you might have to handle NULL values in the JavaScript, because the following expects cell value as integer not null.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;var value = parseInt(cell.value);
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 18 Jan 2019 15:04:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-colors-to-a-table-for-dynamic-columns/m-p/411423#M118679</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2019-01-18T15:04:26Z</dc:date>
    </item>
    <item>
      <title>Re: Add colors to a table for dynamic columns</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-colors-to-a-table-for-dynamic-columns/m-p/411424#M118680</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;Thanks for your replay.&lt;BR /&gt;
I added in the workaround of renaming it to _time as if i leave it as TAG i will get NaN.&lt;BR /&gt;
I don't have any NULL values.&lt;/P&gt;

&lt;P&gt;So if i try the follwing i will get NaN, but if i use my workaround of renaming | rename TAG as _time it working. The data does not change.&lt;/P&gt;

&lt;P&gt;The below code does not work. (Unless i change 2 things, 1st rename TAG to _time and update script from TAG to _time)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;query&amp;gt;| tstats summariesonly=true values(All_TPS_Logs.duration) AS Duration max(All_TPS_Logs.duration) AS All_TPS_Logs.duration FROM datamodel=TPS_V5 WHERE (nodename=All_TPS_Logs host=LUAS_2019_01_01 All_TPS_Logs.duration &amp;amp;lt;= 1000000000000 All_TPS_Logs.duration &amp;amp;gt;= -10000000 (All_TPS_Logs.user=* OR NOT All_TPS_Logs.user=*) All_TPS_Logs.operationIdentity="*") All_TPS_Logs.name =*** GROUPBY _time, All_TPS_Logs.fullyQualifiedMethod span=1s 
    | rename All_TPS_Logs.fullyQualifiedMethod as series 
    | rename All_TPS_Logs.duration as value 
    | table _time series value 
    | search (series=**murex**) 
    | lookup TPS_TAGS_HIGH_LEVEL Method#Class AS "series" OUTPUT TAG Threshold 
    | where value &amp;amp;gt; Threshold 
    | fillnull Threshold 
    | fillnull TAG 
    | eval TAG=if(TAG=0,"PLEASE_ADD_TAG",TAG) 
     | search NOT TAG = "PLEASE_ADD_TAG"
| timechart span=1h count(value) by TAG 
| untable _time TAG value 
| eval c_time=strftime(_time,"%F %T") 
| xyseries TAG c_time value &amp;lt;/query&amp;gt;

require([
     "underscore",
     "jquery",
     "splunkjs/mvc",
     "splunkjs/mvc/searchmanager",
     "splunkjs/mvc/tableview",
     "splunkjs/mvc/simplexml/ready!"
 ], function(_, $, mvc, SearchManager, TableView) {

     var mySearch = splunkjs.mvc.Components.getInstance("myTableSearch");
     var myResults = mySearch.data("results", {count:0});
     var allFields,filteredFields;
     myResults.on("data", function(){
         allFields=myResults.data().fields;
         filteredFields=allFields.filter(filterFields);
         console.log("Filtered Fields:",filteredFields);
     });
     function filterFields(field) {
         return field !== "TAG";
     }
     // Row Coloring Example with custom, client-side range interpretation
     var CustomRangeRenderer = TableView.BaseCellRenderer.extend({
         canRender: function(cell) {
             // Enable this custom cell renderer for all fields except TAG
             return _(filteredFields).contains(cell.field);
         },
         render: function($td, cell) {
             // Add a class to the cell based on the returned value
             var value = parseInt(cell.value);

             // Apply interpretation based on count of errors per TAG for each field
             if(cell.field !== "TAG"){
                 if (value &amp;gt;= 5) {
                     $td.addClass("range-cell").addClass("range-severe");
                 }
                 else if (value &amp;gt;= 1 &amp;amp;&amp;amp; value &amp;lt; 5) {
                     $td.addClass("range-cell").addClass("range-elevated");
                 }
                 else if (value &amp;lt; 1) {
                     $td.addClass("range-cell").addClass("range-low");
                 }
                 // Update the cell content
                 $td.text(value).addClass("numeric");
             }
         }
     });
     mvc.Components.get("highlight").getVisualization(function(tableView) {
         // Add custom cell renderer, the table will re-render automatically.
         tableView.addCellRenderer(new CustomRangeRenderer());
     });

 });
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 18 Jan 2019 16:05:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-colors-to-a-table-for-dynamic-columns/m-p/411424#M118680</guid>
      <dc:creator>robertlynch2020</dc:creator>
      <dc:date>2019-01-18T16:05:24Z</dc:date>
    </item>
    <item>
      <title>Re: Add colors to a table for dynamic columns</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-colors-to-a-table-for-dynamic-columns/m-p/411425#M118681</link>
      <description>&lt;P&gt;On a separate question.&lt;BR /&gt;
If i have 2 tables with different colors needs on the same page.&lt;BR /&gt;
AS you can have 2 tables with the same ID i hvae tried to duplicate as much as i can... but i am missing something&lt;BR /&gt;
I have tried to duplicate your cool script&lt;/P&gt;

&lt;P&gt;Then i have renamed parts, but&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    &amp;lt;search id="myTableSearch1"&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then in the script &lt;BR /&gt;
 var mySearch = splunkjs.mvc.Components.getInstance("myTableSearch1");&lt;/P&gt;

&lt;P&gt;But i cant get it to work, so sorry my java script is not great, what else do i need to change.&lt;/P&gt;

&lt;P&gt;so this is my trying to call the new script &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;panel depends="$alaysHideCSS$"&amp;gt;
  &amp;lt;html&amp;gt;
     &amp;lt;style&amp;gt;
       #highlight1 td {
           background-color: #6DB7C6 !important;
       }
       */
       #highlight1 td.range-low {
           color: #6DB7C6;
       }
       #highlight1 td.range-elevated {
           background-color: #ffc57a !important;
           font-weight: bold;
       }
       #highlight1 td.range-severe {
           background-color: #d59392 !important;
           font-weight: bold;
       }          
     &amp;lt;/style&amp;gt;
   &amp;lt;/html&amp;gt;
&amp;lt;/panel&amp;gt;
&amp;lt;panel&amp;gt;
 &amp;lt;title&amp;gt;OK - Real Time (Count)&amp;lt;/title&amp;gt;
  &amp;lt;table id="highlight1"&amp;gt;
    &amp;lt;search id="myTableSearch1"&amp;gt;
      &amp;lt;query&amp;gt;| tstats summariesonly=true values(All_TPS_Logs.duration) AS Duration max(All_TPS_Logs.duration) AS All_TPS_Logs.duration FROM datamodel=TPS_V5 WHERE (nodename=All_TPS_Logs host=LUAS_2019_01_01 All_TPS_Logs.duration &amp;amp;lt;= 1000000000000 All_TPS_Logs.duration &amp;amp;gt;= -10000000 (All_TPS_Logs.user=* OR NOT All_TPS_Logs.user=*) All_TPS_Logs.operationIdentity="*") All_TPS_Logs.name =*** GROUPBY _time, All_TPS_Logs.fullyQualifiedMethod span=1s 
| rename All_TPS_Logs.fullyQualifiedMethod as series 
| rename All_TPS_Logs.duration as value 
| table _time series value 
| search (series=**murex**) 
| lookup TPS_TAGS_HIGH_LEVEL Method#Class AS "series" OUTPUT TAG Threshold 
| where value &amp;amp;gt; Threshold 
| fillnull Threshold 
| fillnull TAG 
| eval TAG=if(TAG=0,"PLEASE_ADD_TAG",TAG) 
 | search NOT TAG = "PLEASE_ADD_TAG"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;| timechart span=1h count(value) by TAG &lt;BR /&gt;
| untable _time TAG value &lt;BR /&gt;
| eval c_time=strftime(_time,"%F %T") &lt;BR /&gt;
| xyseries TAG c_time value | rename TAG as _time&lt;BR /&gt;
            &lt;EARLIEST&gt;$time_token.earliest$&lt;/EARLIEST&gt;&lt;BR /&gt;
          &lt;LATEST&gt;$time_token.latest$&lt;/LATEST&gt;&lt;BR /&gt;
          &lt;SAMPLERATIO&gt;1&lt;/SAMPLERATIO&gt;&lt;BR /&gt;
        &lt;BR /&gt;
        20&lt;BR /&gt;
        none&lt;BR /&gt;
        none&lt;BR /&gt;
        false&lt;BR /&gt;
        false&lt;BR /&gt;
        false&lt;BR /&gt;
        true&lt;BR /&gt;
      &lt;BR /&gt;
    &lt;/P&gt;

&lt;P&gt;and this is the new scripts. I have only change one line&lt;BR /&gt;
 var mySearch = splunkjs.mvc.Components.getInstance("myTableSearch1");&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;require([
     "underscore",
     "jquery",
     "splunkjs/mvc",
     "splunkjs/mvc/searchmanager",
     "splunkjs/mvc/tableview",
     "splunkjs/mvc/simplexml/ready!"
 ], function(_, $, mvc, SearchManager, TableView) {

     var mySearch = splunkjs.mvc.Components.getInstance("myTableSearch1");
     var myResults = mySearch.data("results", {count:0});
     var allFields,filteredFields;
     myResults.on("data", function(){
         allFields=myResults.data().fields;
         filteredFields=allFields.filter(filterFields);
         console.log("Filtered Fields:",filteredFields);
     });
     function filterFields(field) {
         return field !== "_time";
     }
     // Row Coloring Example with custom, client-side range interpretation
     var CustomRangeRenderer = TableView.BaseCellRenderer.extend({
         canRender: function(cell) {
             // Enable this custom cell renderer for all fields except _time
             return _(filteredFields).contains(cell.field);
         },
         render: function($td, cell) {
             // Add a class to the cell based on the returned value
             var value = parseInt(cell.value);

             // Apply interpretation based on count of errors per _time for each field
             if(cell.field !== "_time"){
                 if (value &amp;gt;= 5) {
                     $td.addClass("range-cell").addClass("range-severe");
                 }
                 else if (value &amp;gt;= 1 &amp;amp;&amp;amp; value &amp;lt; 5) {
                     $td.addClass("range-cell").addClass("range-elevated");
                 }
                 else if (value &amp;lt; 1) {
                     $td.addClass("range-cell").addClass("range-low");
                 }
                 // Update the cell content
                 $td.text(value).addClass("numeric");
             }
         }
     });
     mvc.Components.get("highlight1").getVisualization(function(tableView) {
         // Add custom cell renderer, the table will re-render automatically.
         tableView.addCellRenderer(new CustomRangeRenderer());
     });

 });
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks in advance&lt;BR /&gt;
Rob&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 22:50:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-colors-to-a-table-for-dynamic-columns/m-p/411425#M118681</guid>
      <dc:creator>robertlynch2020</dc:creator>
      <dc:date>2020-09-29T22:50:15Z</dc:date>
    </item>
    <item>
      <title>Re: Add colors to a table for dynamic columns</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-colors-to-a-table-for-dynamic-columns/m-p/411426#M118682</link>
      <description>&lt;P&gt;Following is a run anywhere example I have created similar to data in the screenshot attached in the question. Seems to work fine for me. Can you add table command in your search to ensure that only required fields are present and no internal fields?&lt;/P&gt;

&lt;P&gt;Have you checked Console log using Internet Browser's Inspector tool? See if there are any JavaScript Error. My JavaScript was logging list of fields from the search as array. You can check and validate that TAG field should not show up there. Also no fields other than &lt;CODE&gt;00:##:##&lt;/CODE&gt; should show up. You can add a console.log for &lt;CODE&gt;parseInt()&lt;/CODE&gt; function as well to see whether it works.&lt;/P&gt;

&lt;P&gt;Please try the following Simple XML Run anywhere Dashboard which creates a subset of your data:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;dashboard script="table_cell_highlight_all_fields.js"&amp;gt;
  &amp;lt;label&amp;gt;Table with Color on all fields dynamically with excluded fields&amp;lt;/label&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;html depends="$alwaysHideCSSStyle$"&amp;gt;
        &amp;lt;style&amp;gt;
          #highlight td {
              background-color: #c1ffc3 !important;
          }
          */
          #highlight td.range-low {
              color: #C0D9D9;
          }
          #highlight td.range-elevated {
              background-color: #ffc57a !important;
              font-weight: bold;
          }
          #highlight td.range-severe {
              background-color: #d59392 !important;
              font-weight: bold;
          }
        &amp;lt;/style&amp;gt;
      &amp;lt;/html&amp;gt;
      &amp;lt;table id="highlight"&amp;gt;
        &amp;lt;search id="myTableSearch"&amp;gt;
          &amp;lt;query&amp;gt;| makeresults
| eval data="Limits Preview,0,0,5,82;Trade Insertion,1,56,0,0"
| makemv data delim=";"
| mvexpand data
| makemv data delim=","
| eval TAG=mvindex(data,0),"00:00:00"=mvindex(data,1),"00:01:00"=mvindex(data,2),"00:02:00"=mvindex(data,3),"00:03:00"=mvindex(data,4)
| table TAG "00:*"&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;sampleRatio&amp;gt;1&amp;lt;/sampleRatio&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="count"&amp;gt;20&amp;lt;/option&amp;gt;
        &amp;lt;option name="dataOverlayMode"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="percentagesRow"&amp;gt;false&amp;lt;/option&amp;gt;
        &amp;lt;option name="rowNumbers"&amp;gt;false&amp;lt;/option&amp;gt;
        &amp;lt;option name="totalsRow"&amp;gt;false&amp;lt;/option&amp;gt;
        &amp;lt;option name="wrap"&amp;gt;true&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;Following is the code for &lt;CODE&gt;table_cell_highlight_all_fields.js.js&lt;/CODE&gt; file&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;require([
      "underscore",
      "jquery",
      "splunkjs/mvc",
      "splunkjs/mvc/searchmanager",
      "splunkjs/mvc/tableview",
      "splunkjs/mvc/simplexml/ready!"
  ], function(_, $, mvc, SearchManager, TableView) {

      var mySearch = splunkjs.mvc.Components.getInstance("myTableSearch");
      var myResults = mySearch.data("results", {count:0});
      var allFields,filteredFields;
      myResults.on("data", function(){
          allFields=myResults.data().fields;
          filteredFields=allFields.filter(filterFields);
          console.log("Filtered Fields:",filteredFields);
      });
      function filterFields(field) {
          return field !== "TAG";
      }
      // Row Coloring Example with custom, client-side range interpretation
      var CustomRangeRenderer = TableView.BaseCellRenderer.extend({
          canRender: function(cell) {
              // Enable this custom cell renderer for all fields except TAG
              return _(filteredFields).contains(cell.field);
          },
          render: function($td, cell) {
              // Add a class to the cell based on the returned value
              var value = parseInt(cell.value);

              // Apply interpretation based on count of errors per TAG for each field
              if(cell.field !== "TAG"){
                  if (value &amp;gt;= 5) {
                      $td.addClass("range-cell").addClass("range-severe");
                  }
                  else if (value &amp;gt;= 1 &amp;amp;&amp;amp; value &amp;lt; 5) {
                      $td.addClass("range-cell").addClass("range-elevated");
                  }
                  else if (value &amp;lt; 1) {
                      $td.addClass("range-cell").addClass("range-low");
                  }
                  // Update the cell content
                  $td.text(value).addClass("numeric");
              }
          }
      });
      mvc.Components.get("highlight").getVisualization(function(tableView) {
          // Add custom cell renderer, the table will re-render automatically.
          tableView.addCellRenderer(new CustomRangeRenderer());
      });  
  });
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 19 Jan 2019 20:43:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-colors-to-a-table-for-dynamic-columns/m-p/411426#M118682</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2019-01-19T20:43:07Z</dc:date>
    </item>
    <item>
      <title>Re: Add colors to a table for dynamic columns</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-colors-to-a-table-for-dynamic-columns/m-p/411427#M118683</link>
      <description>&lt;P&gt;Hi &lt;/P&gt;

&lt;P&gt;Thank very much for this, i think i have found the issue.&lt;BR /&gt;
If i use table it works, i was using  | xyseries TAG c_time value (This does not work) . &lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;However&lt;/STRONG&gt; i need to use | xyseries TAG c_time value as the values i am producing are dynamic (Its time and a date[I have also now need the year and month etc..] so its changing all the time) so unless i can use the table command and sat TAG and everything..not sure that is possible.&lt;/P&gt;

&lt;P&gt;However this is not the end of the world if i use _time that table does not look so bad..&lt;/P&gt;

&lt;P&gt;So again thanks for you help you have been very very good &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 20 Jan 2019 12:06:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-colors-to-a-table-for-dynamic-columns/m-p/411427#M118683</guid>
      <dc:creator>robertlynch2020</dc:creator>
      <dc:date>2019-01-20T12:06:57Z</dc:date>
    </item>
    <item>
      <title>Re: Add colors to a table for dynamic columns</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-colors-to-a-table-for-dynamic-columns/m-p/411428#M118684</link>
      <description>&lt;P&gt;I am not sure why xyseries would not work. How about trying the following?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| table TAG *
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hope your issue gets resolved. If the comments have helped do upvote answer/comment &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 20 Jan 2019 17:21:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-colors-to-a-table-for-dynamic-columns/m-p/411428#M118684</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2019-01-20T17:21:53Z</dc:date>
    </item>
    <item>
      <title>Re: Add colors to a table for dynamic columns</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-colors-to-a-table-for-dynamic-columns/m-p/411429#M118685</link>
      <description>&lt;P&gt;Hi @niketnilay &lt;/P&gt;

&lt;P&gt;I have the same problem, but is it possible to only do it through the use of tokens instead of going through JavaScript? I already tried using this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;done&amp;gt;
            &amp;lt;condition match="'job.resultCount' &amp;amp;gt; 0"&amp;gt;
                        &amp;lt;set token="Date"&amp;gt;$result.date$&amp;lt;/set&amp;gt;
            &amp;lt;/condition&amp;gt;
&amp;lt;/done&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It captures the result of the "date" field from my search query, which serves as table columns. Then the $Date$ token should be the field name of formatting the table:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;format type="color" field="$Date$"&amp;gt;
          &amp;lt;colorPalette type="list"&amp;gt;[#BF3939,#36B1C1,#414A75,#414A75]&amp;lt;/colorPalette&amp;gt;
          &amp;lt;scale type="threshold"&amp;gt;80,99,100&amp;lt;/scale&amp;gt;
&amp;lt;/format&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;My desired output should have different color ranges depending on each table cell value.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jun 2019 09:13:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-colors-to-a-table-for-dynamic-columns/m-p/411429#M118685</guid>
      <dc:creator>marxsabandana</dc:creator>
      <dc:date>2019-06-04T09:13:37Z</dc:date>
    </item>
    <item>
      <title>Re: Add colors to a table for dynamic columns</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-colors-to-a-table-for-dynamic-columns/m-p/411430#M118686</link>
      <description>&lt;P&gt;@marxsabandana I will try and see if this is possible. However, I doubt that when token changes visualization will be reset the formatting. If you know what your field names are going to be then Simple XML would be sufficient, otherwise JS is the better and more dynamic way.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jun 2019 11:19:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-colors-to-a-table-for-dynamic-columns/m-p/411430#M118686</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2019-06-04T11:19:39Z</dc:date>
    </item>
    <item>
      <title>Re: Add colors to a table for dynamic columns</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-colors-to-a-table-for-dynamic-columns/m-p/411431#M118687</link>
      <description>&lt;P&gt;A little late to this but you could also try using the following for each table:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;format type="color"&amp;gt;
          &amp;lt;colorPalette type="map"&amp;gt;{"0":#DC4E41,"1":#53A051}&amp;lt;/colorPalette&amp;gt;
&amp;lt;/format&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Taking the "field=" specification off seems to apply it to the entire row by default. &lt;/P&gt;

&lt;P&gt;Hope this helps!&lt;/P&gt;</description>
      <pubDate>Fri, 29 May 2020 17:54:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-colors-to-a-table-for-dynamic-columns/m-p/411431#M118687</guid>
      <dc:creator>kaeleyt</dc:creator>
      <dc:date>2020-05-29T17:54:18Z</dc:date>
    </item>
    <item>
      <title>Re: Add colors to a table for dynamic columns</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-add-colors-to-a-table-for-dynamic-columns/m-p/607177#M211114</link>
      <description>&lt;P&gt;Wow this made my life so much easier! Thank you&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/191500"&gt;@kaeleyt&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":smiling_face_with_heart_eyes:"&gt;😍&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jul 2022 12:22:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-add-colors-to-a-table-for-dynamic-columns/m-p/607177#M211114</guid>
      <dc:creator>black_bagel</dc:creator>
      <dc:date>2022-07-27T12:22:27Z</dc:date>
    </item>
  </channel>
</rss>

