<?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: Unexpected behaviours dropdown in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Unexpected-behaviours-dropdown/m-p/322112#M20730</link>
    <description>&lt;P&gt;Perfect.. Thanks.&lt;/P&gt;

&lt;P&gt;It works even if I don't fully understand the query you wrote  (| gentimes start=-1 .... |s$ ....). &lt;BR /&gt;
Could you just explain it?&lt;/P&gt;</description>
    <pubDate>Wed, 22 Feb 2017 12:16:04 GMT</pubDate>
    <dc:creator>faustf</dc:creator>
    <dc:date>2017-02-22T12:16:04Z</dc:date>
    <item>
      <title>Unexpected behaviours dropdown</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Unexpected-behaviours-dropdown/m-p/322110#M20728</link>
      <description>&lt;P&gt;Hi guys,&lt;BR /&gt;
I have this code:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form&amp;gt;
  &amp;lt;label&amp;gt;Fault Stats&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;input type="dropdown" token="failureID" searchWhenChanged="true"&amp;gt;
        &amp;lt;label&amp;gt;FailureID&amp;lt;/label&amp;gt;
        &amp;lt;fieldForLabel&amp;gt;Date&amp;lt;/fieldForLabel&amp;gt;
        &amp;lt;fieldForValue&amp;gt;FailureID&amp;lt;/fieldForValue&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;MYQUERY&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;0&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;&amp;lt;/latest&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;change&amp;gt;
          &amp;lt;eval token="failureID.earliest"&amp;gt;relative_time($value$, $minBefore$)&amp;lt;/eval&amp;gt;
          &amp;lt;eval token="failureID.latest"&amp;gt;value&amp;lt;/eval&amp;gt;
        &amp;lt;/change&amp;gt;
      &amp;lt;/input&amp;gt;
      &amp;lt;input type="dropdown" token="minBefore" searchWhenChanged="true"&amp;gt;
        &amp;lt;label&amp;gt;Time before fault&amp;lt;/label&amp;gt;
        &amp;lt;choice value="-1m"&amp;gt;1 minute&amp;lt;/choice&amp;gt;
        &amp;lt;choice value="-5m"&amp;gt;5 minutes&amp;lt;/choice&amp;gt;
        &amp;lt;choice value="-15m"&amp;gt;15 minutes&amp;lt;/choice&amp;gt;
        &amp;lt;choice value="-1h"&amp;gt;60 minutes&amp;lt;/choice&amp;gt;
        &amp;lt;choice value="-1d"&amp;gt;24 hours&amp;lt;/choice&amp;gt;
        &amp;lt;default&amp;gt;-15m&amp;lt;/default&amp;gt;
        &amp;lt;initialValue&amp;gt;-15m&amp;lt;/initialValue&amp;gt;
        &amp;lt;change&amp;gt;
            &amp;lt;eval token="failureID.earliest"&amp;gt;relative_time($failureID$,$minBefore$)&amp;lt;/eval&amp;gt;
            &amp;lt;eval token="failureID.latest"&amp;gt;$failureID$&amp;lt;/eval&amp;gt;
        &amp;lt;/change&amp;gt;
      &amp;lt;/input&amp;gt;
      &amp;lt;chart&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;MYQUERY&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;$failureID.earliest$&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;$failureID.latest$&amp;lt;/latest&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="charting.chart"&amp;gt;line&amp;lt;/option&amp;gt;
      &amp;lt;/chart&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;That creates this panel:&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/2536i0279E8FAC39CC7B2/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;The time range of the graph should be: &lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;[LeftDropDownSelectedValue - RightDropDownSelectedValue, LeftDropDownValue]&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;Also every time That You change the selected value of dropdown Both the graph Should be redrawn.&lt;BR /&gt;
At the beginning it seemed to work fine but, if you play a bit with the right dropdown I noticed two unexpected behaviours:&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;Some times the graph is not redrawn when the right dropdown value changes&lt;/LI&gt;
&lt;LI&gt;After playing a bit with the right dropdown the graph interval is wrong (if you look at the previous picture I selected 1 minutes but the interval is 1 day)&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;Am I doing something wrong?&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2017 11:23:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Unexpected-behaviours-dropdown/m-p/322110#M20728</guid>
      <dc:creator>faustf</dc:creator>
      <dc:date>2017-02-22T11:23:46Z</dc:date>
    </item>
    <item>
      <title>Re: Unexpected behaviours dropdown</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Unexpected-behaviours-dropdown/m-p/322111#M20729</link>
      <description>&lt;P&gt;Your attempt to add a second dropdown that affects the value calculated in the first dropdown is going to create some inconsistencies. If you want the second dropdown to be used in conjunction with the value in the first dropdown, then you have to change how you calculate the time period for the panel. You have to move all of the logic that calculates the final search period into one place.&lt;/P&gt;

&lt;P&gt;The easiest way of doing this is probably moving that logic into the search itself with a subsearch at the beginning of the query for the line chart.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form&amp;gt;
 &amp;lt;label&amp;gt;Fault Stats&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;input type="dropdown" token="failureID" searchWhenChanged="true"&amp;gt;
       &amp;lt;label&amp;gt;FailureID&amp;lt;/label&amp;gt;
       &amp;lt;fieldForLabel&amp;gt;Date&amp;lt;/fieldForLabel&amp;gt;
       &amp;lt;fieldForValue&amp;gt;FailureID&amp;lt;/fieldForValue&amp;gt;
       &amp;lt;search&amp;gt;
         &amp;lt;query&amp;gt;MYQUERY&amp;lt;/query&amp;gt;
         &amp;lt;earliest&amp;gt;0&amp;lt;/earliest&amp;gt;
         &amp;lt;latest&amp;gt;&amp;lt;/latest&amp;gt;
       &amp;lt;/search&amp;gt;
     &amp;lt;/input&amp;gt;
     &amp;lt;input type="dropdown" token="minBefore" searchWhenChanged="true"&amp;gt;
       &amp;lt;label&amp;gt;Time before fault&amp;lt;/label&amp;gt;
       &amp;lt;choice value="-1m"&amp;gt;1 minute&amp;lt;/choice&amp;gt;
       &amp;lt;choice value="-5m"&amp;gt;5 minutes&amp;lt;/choice&amp;gt;
       &amp;lt;choice value="-15m"&amp;gt;15 minutes&amp;lt;/choice&amp;gt;
       &amp;lt;choice value="-1h"&amp;gt;60 minutes&amp;lt;/choice&amp;gt;
       &amp;lt;choice value="-1d"&amp;gt;24 hours&amp;lt;/choice&amp;gt;
       &amp;lt;default&amp;gt;-15m&amp;lt;/default&amp;gt;
     &amp;lt;/input&amp;gt;
     &amp;lt;chart&amp;gt;
       &amp;lt;search&amp;gt;
         &amp;lt;query&amp;gt;Beginning of MYQUERY [| gentimes start=-1 | eval earliest = relative_time($failureID$,$minBefore|s$) | eval latest = $failureID$ | return earliest, latest] | ...&amp;lt;/query&amp;gt;
       &amp;lt;/search&amp;gt;
       &amp;lt;option name="charting.chart"&amp;gt;line&amp;lt;/option&amp;gt;
     &amp;lt;/chart&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>Wed, 22 Feb 2017 11:49:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Unexpected-behaviours-dropdown/m-p/322111#M20729</guid>
      <dc:creator>rjthibod</dc:creator>
      <dc:date>2017-02-22T11:49:52Z</dc:date>
    </item>
    <item>
      <title>Re: Unexpected behaviours dropdown</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Unexpected-behaviours-dropdown/m-p/322112#M20730</link>
      <description>&lt;P&gt;Perfect.. Thanks.&lt;/P&gt;

&lt;P&gt;It works even if I don't fully understand the query you wrote  (| gentimes start=-1 .... |s$ ....). &lt;BR /&gt;
Could you just explain it?&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2017 12:16:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Unexpected-behaviours-dropdown/m-p/322112#M20730</guid>
      <dc:creator>faustf</dc:creator>
      <dc:date>2017-02-22T12:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Unexpected behaviours dropdown</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Unexpected-behaviours-dropdown/m-p/322113#M20731</link>
      <description>&lt;P&gt;Please accept the answer if it works.&lt;/P&gt;

&lt;P&gt;Regarding &lt;CODE&gt;| gentimes start=-1| ...&lt;/CODE&gt;, that is a generating command that gives you a single row of data where you can eval other fields and perform calculations. It is simply acting as a placeholder where we can perform calculations as part of the subsearch (i.e., calculating the &lt;CODE&gt;earliest&lt;/CODE&gt; and &lt;CODE&gt;latest&lt;/CODE&gt; values you want), and then the &lt;CODE&gt;return earliest latest&lt;/CODE&gt; command simply returns the calculated values to the primary search. &lt;/P&gt;

&lt;P&gt;In this case, this subsearch is consolidating what you were doing in the &lt;CODE&gt;change&lt;/CODE&gt; blocks in your original version. &lt;/P&gt;

&lt;P&gt;If you want to play with it more, you can put &lt;CODE&gt;|gentimes start=-1| ...&lt;/CODE&gt; directly in a search box and see what it produces. Similarly, you can also use the newer command &lt;CODE&gt;makeresults&lt;/CODE&gt;. It does a similar thing as &lt;CODE&gt;gentimes start=-1&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2017 12:35:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Unexpected-behaviours-dropdown/m-p/322113#M20731</guid>
      <dc:creator>rjthibod</dc:creator>
      <dc:date>2017-02-22T12:35:42Z</dc:date>
    </item>
    <item>
      <title>Re: Unexpected behaviours dropdown</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Unexpected-behaviours-dropdown/m-p/322114#M20732</link>
      <description>&lt;P&gt;Accepted. Thanks.&lt;BR /&gt;
And this "|s$" what it means? &lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2017 12:44:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Unexpected-behaviours-dropdown/m-p/322114#M20732</guid>
      <dc:creator>faustf</dc:creator>
      <dc:date>2017-02-22T12:44:26Z</dc:date>
    </item>
    <item>
      <title>Re: Unexpected behaviours dropdown</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Unexpected-behaviours-dropdown/m-p/322115#M20733</link>
      <description>&lt;P&gt;That is what is referred to as a token filter. That would means wrap the token value in double quotes. &lt;/P&gt;

&lt;P&gt;Here is the documentation on token filters: &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Viz/tokens#Token_filters"&gt;http://docs.splunk.com/Documentation/Splunk/latest/Viz/tokens#Token_filters&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2017 13:01:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Unexpected-behaviours-dropdown/m-p/322115#M20733</guid>
      <dc:creator>rjthibod</dc:creator>
      <dc:date>2017-02-22T13:01:28Z</dc:date>
    </item>
  </channel>
</rss>

