<?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 use a variable in colorpalette expression in SimpleXML? in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-use-a-variable-in-colorpalette-expression-in-SimpleXML/m-p/571747#M46931</link>
    <description>&lt;P&gt;Yes, try this&lt;/P&gt;&lt;P&gt;Threshold values are set in input for demonstration. It could be replaced with other search based tokens as well&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;form&amp;gt;
  &amp;lt;label&amp;gt;Color Palette Token&amp;lt;/label&amp;gt;
  &amp;lt;fieldset submitButton="false"&amp;gt;
    &amp;lt;input type="dropdown" token="threshold" searchWhenChanged="true"&amp;gt;
      &amp;lt;label&amp;gt;Threshold&amp;lt;/label&amp;gt;
      &amp;lt;choice value="100"&amp;gt;100&amp;lt;/choice&amp;gt;
      &amp;lt;choice value="200"&amp;gt;200&amp;lt;/choice&amp;gt;
      &amp;lt;choice value="300"&amp;gt;300&amp;lt;/choice&amp;gt;
      &amp;lt;choice value="500"&amp;gt;500&amp;lt;/choice&amp;gt;
      &amp;lt;choice value="800"&amp;gt;800&amp;lt;/choice&amp;gt;
      &amp;lt;choice value="1000"&amp;gt;1000&amp;lt;/choice&amp;gt;
      &amp;lt;default&amp;gt;100&amp;lt;/default&amp;gt;
      &amp;lt;initialValue&amp;gt;100&amp;lt;/initialValue&amp;gt;
    &amp;lt;/input&amp;gt;
  &amp;lt;/fieldset&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;title&amp;gt;$threshold$&amp;lt;/title&amp;gt;
      &amp;lt;table&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;| makeresults count=10|eval threshold=$threshold$
| eval value=(random() % 1000) + 1&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;-15m&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;option name="refresh.display"&amp;gt;progressbar&amp;lt;/option&amp;gt;
        &amp;lt;format type="color" field="value"&amp;gt;
          &amp;lt;colorPalette type="expression"&amp;gt;if(value &amp;amp;gt; $threshold$, "#DC4E41", "#53A051")&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;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 21 Oct 2021 02:09:48 GMT</pubDate>
    <dc:creator>renjith_nair</dc:creator>
    <dc:date>2021-10-21T02:09:48Z</dc:date>
    <item>
      <title>How to use a variable in colorpalette expression in SimpleXML?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-use-a-variable-in-colorpalette-expression-in-SimpleXML/m-p/571335#M46910</link>
      <description>&lt;P&gt;Dear Splunk community,&lt;/P&gt;&lt;P&gt;How do I use a variable inside a colorpallete expression using SimpleXML? I have the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;mySearch | eval myField = 100&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I have a table that returns rows with numbers in them, I can change the color of that row doing so:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;format type="color" field="sourceField"&amp;gt;
    &amp;lt;colorPalette type="expression"&amp;gt;if (value &amp;gt; myField ,"#df5065","#00FF00")&amp;lt;/colorPalette&amp;gt;
&amp;lt;/format&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Expectation: Any row above 100 is red (df5065) and all other fields are green (00FF00).&lt;/P&gt;&lt;P&gt;Result: All rows are green&lt;/P&gt;&lt;P&gt;I need to use myField to calculate with. How do I do that?&lt;/P&gt;&lt;P&gt;I have tried:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;$myField$
'myField'
(myField)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;None work.&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Oct 2021 13:18:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-use-a-variable-in-colorpalette-expression-in-SimpleXML/m-p/571335#M46910</guid>
      <dc:creator>Bleepie</dc:creator>
      <dc:date>2021-10-18T13:18:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to use a variable in colorpalette expression in SimpleXML?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-use-a-variable-in-colorpalette-expression-in-SimpleXML/m-p/571475#M46921</link>
      <description>&lt;P&gt;You can set the scaling threshold directly in the table visualization.&lt;/P&gt;&lt;P&gt;Try this run anywhere example and see if it fits.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;dashboard&amp;gt;
  &amp;lt;label&amp;gt;Color Palette Token&amp;lt;/label&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;table&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;| makeresults count=10
| eval value=(random() % 1000) + 1&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;-15m&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;option name="refresh.display"&amp;gt;progressbar&amp;lt;/option&amp;gt;
        &amp;lt;format type="color" field="value"&amp;gt;
          &amp;lt;colorPalette type="list"&amp;gt;[#53A051,#DC4E41]&amp;lt;/colorPalette&amp;gt;
          &amp;lt;scale type="threshold"&amp;gt;100&amp;lt;/scale&amp;gt;
        &amp;lt;/format&amp;gt;
      &amp;lt;/table&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/dashboard&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Oct 2021 07:52:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-use-a-variable-in-colorpalette-expression-in-SimpleXML/m-p/571475#M46921</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2021-10-19T07:52:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to use a variable in colorpalette expression in SimpleXML?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-use-a-variable-in-colorpalette-expression-in-SimpleXML/m-p/571484#M46922</link>
      <description>&lt;P&gt;This seems to be a treshold that is fixed (at 100). I want to use my variable because its non-fixed. Is that possible?&lt;/P&gt;</description>
      <pubDate>Tue, 19 Oct 2021 09:12:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-use-a-variable-in-colorpalette-expression-in-SimpleXML/m-p/571484#M46922</guid>
      <dc:creator>Bleepie</dc:creator>
      <dc:date>2021-10-19T09:12:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to use a variable in colorpalette expression in SimpleXML?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-use-a-variable-in-colorpalette-expression-in-SimpleXML/m-p/571747#M46931</link>
      <description>&lt;P&gt;Yes, try this&lt;/P&gt;&lt;P&gt;Threshold values are set in input for demonstration. It could be replaced with other search based tokens as well&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;form&amp;gt;
  &amp;lt;label&amp;gt;Color Palette Token&amp;lt;/label&amp;gt;
  &amp;lt;fieldset submitButton="false"&amp;gt;
    &amp;lt;input type="dropdown" token="threshold" searchWhenChanged="true"&amp;gt;
      &amp;lt;label&amp;gt;Threshold&amp;lt;/label&amp;gt;
      &amp;lt;choice value="100"&amp;gt;100&amp;lt;/choice&amp;gt;
      &amp;lt;choice value="200"&amp;gt;200&amp;lt;/choice&amp;gt;
      &amp;lt;choice value="300"&amp;gt;300&amp;lt;/choice&amp;gt;
      &amp;lt;choice value="500"&amp;gt;500&amp;lt;/choice&amp;gt;
      &amp;lt;choice value="800"&amp;gt;800&amp;lt;/choice&amp;gt;
      &amp;lt;choice value="1000"&amp;gt;1000&amp;lt;/choice&amp;gt;
      &amp;lt;default&amp;gt;100&amp;lt;/default&amp;gt;
      &amp;lt;initialValue&amp;gt;100&amp;lt;/initialValue&amp;gt;
    &amp;lt;/input&amp;gt;
  &amp;lt;/fieldset&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;title&amp;gt;$threshold$&amp;lt;/title&amp;gt;
      &amp;lt;table&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;| makeresults count=10|eval threshold=$threshold$
| eval value=(random() % 1000) + 1&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;-15m&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;option name="refresh.display"&amp;gt;progressbar&amp;lt;/option&amp;gt;
        &amp;lt;format type="color" field="value"&amp;gt;
          &amp;lt;colorPalette type="expression"&amp;gt;if(value &amp;amp;gt; $threshold$, "#DC4E41", "#53A051")&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;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Oct 2021 02:09:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-use-a-variable-in-colorpalette-expression-in-SimpleXML/m-p/571747#M46931</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2021-10-21T02:09:48Z</dc:date>
    </item>
  </channel>
</rss>

