<?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: Dynamic Dropdown Using Timepicker in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Dynamic-Dropdown-Using-Timepicker/m-p/318036#M20478</link>
    <description>&lt;P&gt;Hi @aholzel, thank you for taking the time to reply. Unfortunately it didn't quite work as expected, but as you can see I was able to achieve the expected results from the solution provided by @niketnilay.&lt;/P&gt;

&lt;P&gt;Many thanks and kind regards&lt;/P&gt;

&lt;P&gt;Chris&lt;/P&gt;</description>
    <pubDate>Tue, 11 Apr 2017 09:55:57 GMT</pubDate>
    <dc:creator>IRHM73</dc:creator>
    <dc:date>2017-04-11T09:55:57Z</dc:date>
    <item>
      <title>Dynamic Dropdown Using Timepicker</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Dynamic-Dropdown-Using-Timepicker/m-p/318032#M20474</link>
      <description>&lt;P&gt;Hi, I wonder whether someone could help me please.&lt;/P&gt;

&lt;P&gt;I'm trying to create a dynamic drop down where the values of the 'user' drop down menu will be dependent on the time range selected.&lt;/P&gt;

&lt;P&gt;This is the code I've put together:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form&amp;gt;
  &amp;lt;label&amp;gt;Analysis of Splunk users activity&amp;lt;/label&amp;gt;
  &amp;lt;fieldset submitButton="false"&amp;gt;
    &amp;lt;input searchWhenChanged="true" token="timerange" type="time"&amp;gt;
      &amp;lt;label&amp;gt;Time range:&amp;lt;/label&amp;gt;
      &amp;lt;default&amp;gt;
        &amp;lt;earliest&amp;gt;@d&amp;lt;/earliest&amp;gt;
        &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
      &amp;lt;/default&amp;gt;
    &amp;lt;/input&amp;gt;
    &amp;lt;input type="dropdown" token="user"&amp;gt;
      &amp;lt;label&amp;gt;field1&amp;lt;/label&amp;gt;
      &amp;lt;search&amp;gt;
        &amp;lt;query&amp;gt;(index=_audit action=search) OR (index=_internal) between $timerange.earliest$ and $timerange.latest$
| dedup user
| stats count by user
| fields user
| sort +user&amp;lt;/query&amp;gt;
      &amp;lt;/search&amp;gt;
      &amp;lt;fieldForLabel&amp;gt;user&amp;lt;/fieldForLabel&amp;gt;
      &amp;lt;fieldForValue&amp;gt;user&amp;lt;/fieldForValue&amp;gt;
      &amp;lt;choice value="*"&amp;gt;All&amp;lt;/choice&amp;gt;
    &amp;lt;/input&amp;gt;
  &amp;lt;/fieldset&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But I can't get the drop down menu to populate with the correct users.&lt;/P&gt;

&lt;P&gt;I just wondered whether someone could look at this please and offer some guidance on how I may go about achieving this and where I've gone wrong?&lt;/P&gt;

&lt;P&gt;Many thanks and kind regards&lt;/P&gt;

&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Tue, 11 Apr 2017 06:44:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Dynamic-Dropdown-Using-Timepicker/m-p/318032#M20474</guid>
      <dc:creator>IRHM73</dc:creator>
      <dc:date>2017-04-11T06:44:34Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Dropdown Using Timepicker</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Dynamic-Dropdown-Using-Timepicker/m-p/318033#M20475</link>
      <description>&lt;P&gt;you should add the time range below the search between earliest and latest brackets ( just like the timerange input):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form&amp;gt;
   &amp;lt;label&amp;gt;Analysis of Splunk users activity&amp;lt;/label&amp;gt;
   &amp;lt;fieldset submitButton="false"&amp;gt;
     &amp;lt;input searchWhenChanged="true" token="timerange" type="time"&amp;gt;
       &amp;lt;label&amp;gt;Time range:&amp;lt;/label&amp;gt;
       &amp;lt;default&amp;gt;
         &amp;lt;earliest&amp;gt;@d&amp;lt;/earliest&amp;gt;
         &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
       &amp;lt;/default&amp;gt;
     &amp;lt;/input&amp;gt;
     &amp;lt;input type="dropdown" token="user"&amp;gt;
       &amp;lt;label&amp;gt;field1&amp;lt;/label&amp;gt;
       &amp;lt;search&amp;gt;
         &amp;lt;query&amp;gt;(index=_audit action=search) OR (index=_internal)
 | dedup user
 | stats count by user
 | fields user
 | sort +user&amp;lt;/query&amp;gt;
       &amp;lt;/search&amp;gt;
         &amp;lt;earliest&amp;gt;$timerange.earliest$&amp;lt;/earliest&amp;gt;
         &amp;lt;latest&amp;gt;$timerange.latest$&amp;lt;/latest&amp;gt;
       &amp;lt;fieldForLabel&amp;gt;user&amp;lt;/fieldForLabel&amp;gt;
       &amp;lt;fieldForValue&amp;gt;user&amp;lt;/fieldForValue&amp;gt;
       &amp;lt;choice value="*"&amp;gt;All&amp;lt;/choice&amp;gt;
     &amp;lt;/input&amp;gt;
   &amp;lt;/fieldset&amp;gt;
 &amp;lt;/form&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 11 Apr 2017 08:45:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Dynamic-Dropdown-Using-Timepicker/m-p/318033#M20475</guid>
      <dc:creator>aholzel</dc:creator>
      <dc:date>2017-04-11T08:45:35Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Dropdown Using Timepicker</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Dynamic-Dropdown-Using-Timepicker/m-p/318034#M20476</link>
      <description>&lt;P&gt;Only way to include global time picker tokens in Inputs like dropdown would be to use earliest and latest in the base query itself &lt;CODE&gt;earliest=$timerange.earliest$ latest=$timerange.latest$&lt;/CODE&gt;. Input controls will not allow you to define &lt;CODE&gt;&amp;lt;earliest&amp;gt;&lt;/CODE&gt; and &lt;CODE&gt;&amp;lt;latest&amp;gt;&lt;/CODE&gt; nodes for time picker token selection.&lt;/P&gt;

&lt;P&gt;Also if you are using dedup on user, you don't need to add stats again (both will perform the same task so you can finally use table user command).&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;      &amp;lt;input type="dropdown" token="user"&amp;gt;
        &amp;lt;label&amp;gt;Select User&amp;lt;/label&amp;gt;
       &amp;lt;search&amp;gt;
         &amp;lt;query&amp;gt;(index=_audit action=search) OR (index=_internal) earliest=$timerange.earliest$ latest=$timerange.latest$
 | dedup user
 | sort user
 | table user&amp;lt;/query&amp;gt;
       &amp;lt;/search&amp;gt;
       &amp;lt;/search&amp;gt;
       &amp;lt;fieldForLabel&amp;gt;user&amp;lt;/fieldForLabel&amp;gt;
       &amp;lt;fieldForValue&amp;gt;user&amp;lt;/fieldForValue&amp;gt;
       &amp;lt;choice value="*"&amp;gt;All&amp;lt;/choice&amp;gt;
     &amp;lt;/input&amp;gt;
   &amp;lt;/fieldset&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 11 Apr 2017 08:52:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Dynamic-Dropdown-Using-Timepicker/m-p/318034#M20476</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-04-11T08:52:39Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Dropdown Using Timepicker</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Dynamic-Dropdown-Using-Timepicker/m-p/318035#M20477</link>
      <description>&lt;P&gt;Hi @niketnilay, thank you for taking the time to reply. The solution works great.&lt;/P&gt;

&lt;P&gt;Many thanks and kind regards&lt;/P&gt;

&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Tue, 11 Apr 2017 09:54:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Dynamic-Dropdown-Using-Timepicker/m-p/318035#M20477</guid>
      <dc:creator>IRHM73</dc:creator>
      <dc:date>2017-04-11T09:54:24Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Dropdown Using Timepicker</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Dynamic-Dropdown-Using-Timepicker/m-p/318036#M20478</link>
      <description>&lt;P&gt;Hi @aholzel, thank you for taking the time to reply. Unfortunately it didn't quite work as expected, but as you can see I was able to achieve the expected results from the solution provided by @niketnilay.&lt;/P&gt;

&lt;P&gt;Many thanks and kind regards&lt;/P&gt;

&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Tue, 11 Apr 2017 09:55:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Dynamic-Dropdown-Using-Timepicker/m-p/318036#M20478</guid>
      <dc:creator>IRHM73</dc:creator>
      <dc:date>2017-04-11T09:55:57Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Dropdown Using Timepicker</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Dynamic-Dropdown-Using-Timepicker/m-p/318037#M20479</link>
      <description>&lt;P&gt;Anytime Chris... Glad it worked! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Apr 2017 11:37:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Dynamic-Dropdown-Using-Timepicker/m-p/318037#M20479</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-04-11T11:37:12Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Dropdown Using Timepicker</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Dynamic-Dropdown-Using-Timepicker/m-p/318038#M20480</link>
      <description>&lt;P&gt;Hi @aholzel&lt;BR /&gt;
If you include the  and  tags within the  your solution works for me and prevents the search from failling when you choose "All time" in the time picker.&lt;BR /&gt;
Thanks&lt;BR /&gt;
Sven&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jan 2018 21:50:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Dynamic-Dropdown-Using-Timepicker/m-p/318038#M20480</guid>
      <dc:creator>svenfurrer</dc:creator>
      <dc:date>2018-01-23T21:50:48Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Dropdown Using Timepicker</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Dynamic-Dropdown-Using-Timepicker/m-p/515946#M34526</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/201110"&gt;@niketn&lt;/a&gt;&amp;nbsp;I am using customized global time picker. I am pulling data from DB and I need to pass these tokens of global time picker in my DB query to pull the data according to selected presets.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Global time picker consists of&lt;/STRONG&gt; :24HRS,LAST7DAYS,LAST30DAYS,BETWEEN,SINCE.&lt;/P&gt;&lt;P&gt;&lt;FONT size="4"&gt;&amp;lt;input type="time" id="date" token="lowerdate" searchWhenChanged="true"&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;label&amp;gt;Date&amp;lt;/label&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;default&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;earliest&amp;gt;&amp;lt;/earliest&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;latest&amp;gt;&amp;lt;/latest&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/default&amp;gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/input&amp;gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;dbxquery connection=AXI_WER query="select * from SPLUNK.TOOL_TABLE" shortnames=t|eval DATE= strftime(strptime(DATE,"%Y%m%d"),"%m/%d/%Y %H:%M:%S") |eval DATE= strptime(DATE,"%m/%d/%Y %H:%M:%S") &lt;STRONG&gt;&lt;FONT color="#993366"&gt;|search DATE&amp;amp;gt;=$lowerdate.earliest$ AND DATE&amp;amp;lt;=$lowerdate.latest$&lt;/FONT&gt; &lt;/STRONG&gt;|table SYSTEM&lt;/P&gt;&lt;P&gt;P.S. Format of DB DATE FIELD-YYYYMMDD (20200929)&lt;/P&gt;&lt;P&gt;In highlighted part I am able to pass BETWEEN SINCE presets and it works fine. could you please suggest me how to pass other tokens in the query i.e.24hrs,last7days,last30days.&lt;/P&gt;&lt;P&gt;I have reached dead end with my options, so any help would be great!&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Aug 2020 07:12:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Dynamic-Dropdown-Using-Timepicker/m-p/515946#M34526</guid>
      <dc:creator>Ashwini008</dc:creator>
      <dc:date>2020-08-25T07:12:13Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Dropdown Using Timepicker</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Dynamic-Dropdown-Using-Timepicker/m-p/515998#M34532</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/222977"&gt;@Ashwini008&lt;/a&gt;&amp;nbsp;refer to another answer by me with couple of workarounds to set the required tokens based on time input selection. One of the uses input change event handler and other one which is more dynamic uses an independent search:&amp;nbsp;&lt;A href="https://community.splunk.com/t5/Archive/Running-one-of-two-searches-based-on-time-picker-selection/td-p/364411" target="_blank"&gt;https://community.splunk.com/t5/Archive/Running-one-of-two-searches-based-on-time-picker-selection/td-p/364411&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Aug 2020 11:25:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Dynamic-Dropdown-Using-Timepicker/m-p/515998#M34532</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2020-08-25T11:25:54Z</dc:date>
    </item>
  </channel>
</rss>

