<?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: Using custom dropdown to define Time range in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Using-custom-dropdown-to-define-Time-range/m-p/227126#M14083</link>
    <description>&lt;P&gt;There are couple options&lt;/P&gt;

&lt;P&gt;1) Add an change/eval to your dropdown, like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;input type=dropdown id=time token="t"&amp;gt;
....
&amp;lt;change&amp;gt;
&amp;lt;eval token="e"&amp;gt;strptime($value$, "%m/%d/%Y")&amp;lt;/eval&amp;gt;
&amp;lt;/change&amp;gt;
&amp;lt;/input&amp;gt;
...
&amp;lt;chart&amp;gt;
&amp;lt;query&amp;gt; index=_internal earliest=$e$...&amp;lt;/query&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;OR&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal earliest=[| makeresults | eval _time=strptime($tokenTime$, "%m/%d/%Y") | rename _time AS search] | ...
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 30 Sep 2016 22:40:33 GMT</pubDate>
    <dc:creator>sundareshr</dc:creator>
    <dc:date>2016-09-30T22:40:33Z</dc:date>
    <item>
      <title>Using custom dropdown to define Time range</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Using-custom-dropdown-to-define-Time-range/m-p/227125#M14082</link>
      <description>&lt;P&gt;I have a custom dropdown which defines report dates. For example, there is 9/1/2016 which is a September report spanning from 9/1-9/30.&lt;/P&gt;

&lt;P&gt;If I wanted to search the internal index during this report range I thought I should try:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal earliest=strptime("9/1/2016","%m/%d/%Y")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;However, I am given the error "Invalid value "strptime" for time term 'earliest'". Is there a way to pass a value to search earliest and latest without using the time picker?&lt;/P&gt;</description>
      <pubDate>Fri, 30 Sep 2016 22:34:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Using-custom-dropdown-to-define-Time-range/m-p/227125#M14082</guid>
      <dc:creator>markdflip</dc:creator>
      <dc:date>2016-09-30T22:34:50Z</dc:date>
    </item>
    <item>
      <title>Re: Using custom dropdown to define Time range</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Using-custom-dropdown-to-define-Time-range/m-p/227126#M14083</link>
      <description>&lt;P&gt;There are couple options&lt;/P&gt;

&lt;P&gt;1) Add an change/eval to your dropdown, like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;input type=dropdown id=time token="t"&amp;gt;
....
&amp;lt;change&amp;gt;
&amp;lt;eval token="e"&amp;gt;strptime($value$, "%m/%d/%Y")&amp;lt;/eval&amp;gt;
&amp;lt;/change&amp;gt;
&amp;lt;/input&amp;gt;
...
&amp;lt;chart&amp;gt;
&amp;lt;query&amp;gt; index=_internal earliest=$e$...&amp;lt;/query&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;OR&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal earliest=[| makeresults | eval _time=strptime($tokenTime$, "%m/%d/%Y") | rename _time AS search] | ...
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 30 Sep 2016 22:40:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Using-custom-dropdown-to-define-Time-range/m-p/227126#M14083</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-09-30T22:40:33Z</dc:date>
    </item>
    <item>
      <title>Re: Using custom dropdown to define Time range</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Using-custom-dropdown-to-define-Time-range/m-p/227127#M14084</link>
      <description>&lt;P&gt;I had to show events of only one day and I did it in this way:&lt;/P&gt;

&lt;P&gt;I created a dropdown as this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; &amp;lt;input type="dropdown" token="day" searchWhenChanged="true"&amp;gt;
      &amp;lt;label&amp;gt;Day&amp;lt;/label&amp;gt;
      &amp;lt;search&amp;gt;
        &amp;lt;query&amp;gt;
          mysearch 
         | dedup myDay 
         | sort -myDay 
         | eval TokenDay=strftime(strptime(myDay,"%d/%m/%Y"),"%m/%d/%Y") 
         | eval sortDay=strptime(myDay,"%d/%m/%Y") 
         | sort -sortDay 
         | table myDay tokenDay sortDay
        &amp;lt;/query&amp;gt;
      &amp;lt;/search&amp;gt;
      &amp;lt;fieldForLabel&amp;gt;myDay&amp;lt;/fieldForLabel&amp;gt;
      &amp;lt;fieldForValue&amp;gt;tokenDay&amp;lt;/fieldForValue&amp;gt;
    &amp;lt;/input&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and my search was&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;mysearch earliest="$day$:00:00:00" latest="$day$:23:59:59" | ...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Sat, 01 Oct 2016 07:25:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Using-custom-dropdown-to-define-Time-range/m-p/227127#M14084</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2016-10-01T07:25:22Z</dc:date>
    </item>
  </channel>
</rss>

