<?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 do I change the color of a table when I modify the value of a text type filter? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-change-the-color-of-a-table-when-I-modify-the-value-of/m-p/389707#M113548</link>
    <description>&lt;P&gt;Thank you,&lt;/P&gt;

&lt;P&gt;It is what I was doing but I did not update the table correctly since I did not add the token to the search "| fields - $ tok $". the older I add the filter token 1 as a field, the token is named after it&lt;/P&gt;

&lt;P&gt;Greetings and thanks for the inconvenience, and ame works correctly.&lt;/P&gt;</description>
    <pubDate>Fri, 09 Nov 2018 16:58:28 GMT</pubDate>
    <dc:creator>HectorPena</dc:creator>
    <dc:date>2018-11-09T16:58:28Z</dc:date>
    <item>
      <title>How do I change the color of a table when I modify the value of a text type filter?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-change-the-color-of-a-table-when-I-modify-the-value-of/m-p/389704#M113545</link>
      <description>&lt;P&gt;I have a table with 2 filters:&lt;BR /&gt;
 1. Dropdown that selects the column&lt;BR /&gt;
2. Text box (numeric)&lt;/P&gt;

&lt;P&gt;The functionality I want is to color the selected column (dropdown) according to the value of the text box that will be numeric. This value will be an objective, if the value of the column does not exceed it, it will be red, if it exceeds it it will be green.&lt;/P&gt;

&lt;P&gt;A saluted&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/6101i9138FAE7EDA1E390/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Nov 2018 10:31:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-change-the-color-of-a-table-when-I-modify-the-value-of/m-p/389704#M113545</guid>
      <dc:creator>HectorPena</dc:creator>
      <dc:date>2018-11-09T10:31:22Z</dc:date>
    </item>
    <item>
      <title>Re: How do I change the color of a table when I modify the value of a text type filter?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-change-the-color-of-a-table-when-I-modify-the-value-of/m-p/389705#M113546</link>
      <description>&lt;P&gt;@HectorPena, Please try the following run anywhere example PS: I have used reverse color for Threshold as per your use case. You can use following option instead with reverse colors &lt;CODE&gt;#DC4E41 for Red and #53A051 for Green&lt;/CODE&gt;:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;     &amp;lt;format type="color" field="Attendees"&amp;gt;
       &amp;lt;colorPalette type="expression"&amp;gt;if (value&amp;lt; $tokThreshold$,"#DC4E41","#53A051")&amp;lt;/colorPalette&amp;gt;
     &amp;lt;/format&amp;gt;
&lt;/CODE&gt;&lt;/PRE&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/6099i74B2092E1F404607/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;&lt;STRONG&gt;Following is the solution approach used is:&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Step 1)&lt;/STRONG&gt; Create a Text Box to pass the dynamic Threshold value. In the example it is &lt;CODE&gt;tokThreshold&lt;/CODE&gt;.&lt;BR /&gt;
&lt;STRONG&gt;Step 2)&lt;/STRONG&gt; Add the dummy dependency of token to the Search populating the Table so that it re-renders every time token changes. In the example I have added &lt;CODE&gt;| fields - $tokThreshold$&lt;/CODE&gt; which will try to remove a field/column with Name same as Threshold Value from the table (which does not perform any action on the table as the field does not exist). Ideally you should use comment macro for adding dummy dependency i.e. &lt;CODE&gt;comment("This Search runs each time $tokThreshold$ changes.")&lt;/CODE&gt;. &lt;A href="https://answers.splunk.com/answers/683826/how-do-you-set-the-order-of-queries-to-be-run-in-a.html"&gt;Refer to one of my older answers for details about comment macro&lt;/A&gt;.&lt;BR /&gt;
&lt;STRONG&gt;Step 3)&lt;/STRONG&gt; Use Table Cell Color method using &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/Viz/TableFormatsXML#Color_palette_types_and_options"&gt;colorPalette with expressions&lt;/A&gt; (available in Splunk 6.5 and higher). Use &lt;CODE&gt;tokThreshold&lt;/CODE&gt; token in the eval &lt;CODE&gt;if&lt;/CODE&gt; expression to apply respective color.&lt;/P&gt;

&lt;P&gt;Please try out and confirm!&lt;/P&gt;

&lt;P&gt;Following is the run anywhere Simple XML Dashboard code:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form&amp;gt;
  &amp;lt;label&amp;gt;Color Table based on Threshold Input Value&amp;lt;/label&amp;gt;
  &amp;lt;fieldset submitButton="false"&amp;gt;&amp;lt;/fieldset&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;title&amp;gt;Table With Dynamic Threshold via Text Box&amp;lt;/title&amp;gt;
      &amp;lt;input type="text" token="tokThreshold" searchWhenChanged="true"&amp;gt;
        &amp;lt;label&amp;gt;Select Threshold&amp;lt;/label&amp;gt;
        &amp;lt;default&amp;gt;300&amp;lt;/default&amp;gt;
      &amp;lt;/input&amp;gt;
      &amp;lt;table&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;| gentimes start=-7 increment=1d
| eval _time=starttime
| fields _time
| eval Attendees=random()
| eval Attendees=substr(Attendees,0,3)
| fields - $tokThreshold$&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="refresh.display"&amp;gt;progressbar&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;format type="color" field="Attendees"&amp;gt;
          &amp;lt;colorPalette type="expression"&amp;gt;if (value&amp;lt; $tokThreshold$, "#53A051", "#DC4E41")&amp;lt;/colorPalette&amp;gt;
        &amp;lt;/format&amp;gt;
      &amp;lt;/table&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Nov 2018 16:00:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-change-the-color-of-a-table-when-I-modify-the-value-of/m-p/389705#M113546</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-11-09T16:00:10Z</dc:date>
    </item>
    <item>
      <title>Re: How do I change the color of a table when I modify the value of a text type filter?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-change-the-color-of-a-table-when-I-modify-the-value-of/m-p/389706#M113547</link>
      <description>&lt;P&gt;PS: Use &lt;CODE&gt;&amp;amp;lt;&lt;/CODE&gt; in Simple XML Dashboard code for &lt;CODE&gt;expression&lt;/CODE&gt;,  instead of &lt;CODE&gt;&amp;lt;&lt;/CODE&gt; which gets escaped on Splunk Answers. &lt;A href="https://www.advancedinstaller.com/user-guide/xml-escaped-chars.html"&gt;https://www.advancedinstaller.com/user-guide/xml-escaped-chars.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Nov 2018 16:01:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-change-the-color-of-a-table-when-I-modify-the-value-of/m-p/389706#M113547</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-11-09T16:01:54Z</dc:date>
    </item>
    <item>
      <title>Re: How do I change the color of a table when I modify the value of a text type filter?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-change-the-color-of-a-table-when-I-modify-the-value-of/m-p/389707#M113548</link>
      <description>&lt;P&gt;Thank you,&lt;/P&gt;

&lt;P&gt;It is what I was doing but I did not update the table correctly since I did not add the token to the search "| fields - $ tok $". the older I add the filter token 1 as a field, the token is named after it&lt;/P&gt;

&lt;P&gt;Greetings and thanks for the inconvenience, and ame works correctly.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Nov 2018 16:58:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-change-the-color-of-a-table-when-I-modify-the-value-of/m-p/389707#M113548</guid>
      <dc:creator>HectorPena</dc:creator>
      <dc:date>2018-11-09T16:58:28Z</dc:date>
    </item>
    <item>
      <title>Re: How do I change the color of a table when I modify the value of a text type filter?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-change-the-color-of-a-table-when-I-modify-the-value-of/m-p/389708#M113549</link>
      <description>&lt;P&gt;Thank you,&lt;/P&gt;

&lt;P&gt;It is what I was doing but I did not update the table correctly since I did not add the token to the search "| fields - $ tok $". the older I add the filter token 1 as a field, the token is named after it&lt;/P&gt;

&lt;P&gt;Greetings and thanks for the inconvenience, and ame works correctly.&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/6100iA564E28FC3F0F42E/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Nov 2018 16:59:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-change-the-color-of-a-table-when-I-modify-the-value-of/m-p/389708#M113549</guid>
      <dc:creator>HectorPena</dc:creator>
      <dc:date>2018-11-09T16:59:05Z</dc:date>
    </item>
    <item>
      <title>Re: How do I change the color of a table when I modify the value of a text type filter?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-change-the-color-of-a-table-when-I-modify-the-value-of/m-p/389709#M113550</link>
      <description>&lt;P&gt;Thank you,&lt;/P&gt;

&lt;P&gt;It is what I was doing but I did not update the table correctly since I did not add the token to the search "| fields - $ tok $". the older I add the filter token 1 as a field, the token is named after it&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; &amp;lt;format type="color" field="$fKPI_Obj$"&amp;gt;
           &amp;lt;colorPalette type="expression"&amp;gt;if(value &amp;amp;lt; $fObjetivo$, "#53A051","#DC4E41")
           &amp;lt;/colorPalette&amp;gt;
         &amp;lt;/format&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Greetings and thanks for the inconvenience, and ame works correctly.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Nov 2018 17:00:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-change-the-color-of-a-table-when-I-modify-the-value-of/m-p/389709#M113550</guid>
      <dc:creator>HectorPena</dc:creator>
      <dc:date>2018-11-09T17:00:37Z</dc:date>
    </item>
    <item>
      <title>Re: How do I change the color of a table when I modify the value of a text type filter?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-change-the-color-of-a-table-when-I-modify-the-value-of/m-p/389710#M113551</link>
      <description>&lt;P&gt;@niketnilay  thank you in advance for the code example.&lt;BR /&gt;
But I think there is something wrong here: the color will NOT reload as the $tokThreshold$ changes. Based on my test on 7.0.2, I think the color could only be set once. I must reload the whole web page to make the color change. Can you verify that?&lt;/P&gt;

&lt;P&gt;And, is there any xml settings I can force re-paint the color of the panel when $tokThreshold$ changes?&lt;/P&gt;

&lt;P&gt;Also, in your screenshot, when the "Select Threshold" is 300, Attendees ("262", 247) should also be "#53A051"(green), not red. &lt;/P&gt;

&lt;P&gt;I'm using both your example and a rather small set to test:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;&lt;BR /&gt;
| makeresults count=10&lt;BR /&gt;
| streamstats count as id&lt;BR /&gt;
| fields - $tokThreshold$&lt;BR /&gt;
&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Apr 2019 14:35:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-change-the-color-of-a-table-when-I-modify-the-value-of/m-p/389710#M113551</guid>
      <dc:creator>androchentw</dc:creator>
      <dc:date>2019-04-24T14:35:39Z</dc:date>
    </item>
  </channel>
</rss>

