<?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: Populating drop down with values generated from a search in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Populating-drop-down-with-values-generated-from-a-search/m-p/325859#M40540</link>
    <description>&lt;P&gt;@mahbs, For us to assist you better, can you add samples of what your Start Date and End Date look like in your Indexed Events? Also what are their field names.&lt;/P&gt;</description>
    <pubDate>Wed, 25 Oct 2017 11:18:33 GMT</pubDate>
    <dc:creator>niketn</dc:creator>
    <dc:date>2017-10-25T11:18:33Z</dc:date>
    <item>
      <title>Populating drop down with values generated from a search</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Populating-drop-down-with-values-generated-from-a-search/m-p/325856#M40537</link>
      <description>&lt;P&gt;Hi Guys,&lt;/P&gt;

&lt;P&gt;I've searched this question on splunk, however, the examples shown are a bit too complex for me to grasp, hence I'm asking here.&lt;BR /&gt;
I have a search which returns lots of dates. Now what I want is two drop down fields:&lt;/P&gt;

&lt;P&gt;Start Date:                                  End Date:&lt;/P&gt;

&lt;P&gt;These dropdown fields need to be populatd with the dates that are being returned from my search.&lt;/P&gt;

&lt;P&gt;How would I go about going that?&lt;/P&gt;

&lt;P&gt;Kind Regards&lt;BR /&gt;
Mahbs&lt;/P&gt;</description>
      <pubDate>Wed, 25 Oct 2017 10:55:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Populating-drop-down-with-values-generated-from-a-search/m-p/325856#M40537</guid>
      <dc:creator>mahbs</dc:creator>
      <dc:date>2017-10-25T10:55:04Z</dc:date>
    </item>
    <item>
      <title>Re: Populating drop down with values generated from a search</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Populating-drop-down-with-values-generated-from-a-search/m-p/325857#M40538</link>
      <description>&lt;P&gt;Hi mahbs,&lt;BR /&gt;
if you're meaning a time period for timestamps you have only to use a Time Input.&lt;/P&gt;

&lt;P&gt;if Start_Date and Date are two fields of your sourcetype you can populate two inputs with a simple search&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| my_search
| bin Start_Date span=1d
| eval Start_Date=strftime(Start_Date,"%d/%m/%Y")
| dedup Start_Date
| table Start_Date
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| my_search
| bin End_Date span=1d
| eval End_Date =strftime(End_Date ,"%d/%m/%Y")
| dedup End_Date 
| table End_Date 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;so in your searches you can add as token&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;my_search Start_Date="$Start_Date$" End_Date="$End_Date$"
| ...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 25 Oct 2017 11:04:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Populating-drop-down-with-values-generated-from-a-search/m-p/325857#M40538</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2017-10-25T11:04:25Z</dc:date>
    </item>
    <item>
      <title>Re: Populating drop down with values generated from a search</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Populating-drop-down-with-values-generated-from-a-search/m-p/325858#M40539</link>
      <description>&lt;P&gt;Hey Guiseppe,&lt;/P&gt;

&lt;P&gt;Not quite, what i want to do is populate my start date and ed date with all the dates that are returned from the search query. I dont have ay fields in my table labelled "start date" and "end date". What I want the user to be able to do is select a start date and an end date, and the graph should update to show data during that time period.&lt;/P&gt;

&lt;P&gt;This is what I have at the moment:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  &amp;lt;label&amp;gt;Start Date&amp;lt;/label&amp;gt;
  &amp;lt;search fieldForLabel="Dates" fieldForValue="s_d" index="test" sourcetype="csv"&amp;gt;
&amp;lt;/input&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I need to figure out a way of assigning the token to all the dates in my query.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Oct 2017 11:17:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Populating-drop-down-with-values-generated-from-a-search/m-p/325858#M40539</guid>
      <dc:creator>mahbs</dc:creator>
      <dc:date>2017-10-25T11:17:32Z</dc:date>
    </item>
    <item>
      <title>Re: Populating drop down with values generated from a search</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Populating-drop-down-with-values-generated-from-a-search/m-p/325859#M40540</link>
      <description>&lt;P&gt;@mahbs, For us to assist you better, can you add samples of what your Start Date and End Date look like in your Indexed Events? Also what are their field names.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Oct 2017 11:18:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Populating-drop-down-with-values-generated-from-a-search/m-p/325859#M40540</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-10-25T11:18:33Z</dc:date>
    </item>
    <item>
      <title>Re: Populating drop down with values generated from a search</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Populating-drop-down-with-values-generated-from-a-search/m-p/325860#M40541</link>
      <description>&lt;P&gt;hey, absolutely, time stamp is in this format: 2017-10-18 00:00:00&lt;/P&gt;

&lt;P&gt;With regards to the time, I'm currently returning the dates through the following query:&lt;/P&gt;

&lt;P&gt;index="XXX" sourcetype="XXX"  earliest=-1d@d latest=-0d@d | eval ReportKey="Yesterday" |  append [search index="XXX" sourcetype="XXX" earliest= -7d@d latest=now | eval ReportKey="Last Week"] | timechart span= avg("XXX") by ReportKey&lt;/P&gt;

&lt;P&gt;This query returned to me the dates during a specific time period, only trouble is, I'm not sure where the date variable is to store the dates&lt;/P&gt;</description>
      <pubDate>Wed, 25 Oct 2017 11:22:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Populating-drop-down-with-values-generated-from-a-search/m-p/325860#M40541</guid>
      <dc:creator>mahbs</dc:creator>
      <dc:date>2017-10-25T11:22:18Z</dc:date>
    </item>
    <item>
      <title>Re: Populating drop down with values generated from a search</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Populating-drop-down-with-values-generated-from-a-search/m-p/325861#M40542</link>
      <description>&lt;P&gt;You can find the earliest and latest date using stats command, so you can populate your dropdown:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your_search
| stats earliest(_time) AS earliest latest(_time) AS latest
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 25 Oct 2017 11:24:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Populating-drop-down-with-values-generated-from-a-search/m-p/325861#M40542</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2017-10-25T11:24:32Z</dc:date>
    </item>
    <item>
      <title>Re: Populating drop down with values generated from a search</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Populating-drop-down-with-values-generated-from-a-search/m-p/325862#M40543</link>
      <description>&lt;P&gt;Hey Giuseppe,&lt;/P&gt;

&lt;P&gt;I think for this particular task, I would want all the dates to be populated. Just to give users that freedom to choose a date. How would I do that?&lt;/P&gt;</description>
      <pubDate>Wed, 25 Oct 2017 11:27:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Populating-drop-down-with-values-generated-from-a-search/m-p/325862#M40543</guid>
      <dc:creator>mahbs</dc:creator>
      <dc:date>2017-10-25T11:27:43Z</dc:date>
    </item>
    <item>
      <title>Re: Populating drop down with values generated from a search</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Populating-drop-down-with-values-generated-from-a-search/m-p/325863#M40544</link>
      <description>&lt;P&gt;try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;my_search
| bin _time span=1d
| eval Start_Date =strftime(_time ,"%d/%m/%Y")
| dedup Start_Date  
| table Start_Date 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Remeber, when you use tokens, to convert Start_Date and End_Date in epochtime, in othe words:&lt;BR /&gt;
my_search earliest=strptime($Start_Date$,"%d/%m/%Y") latest=strptime($End_Date$,"%d/%m/%Y")&lt;/P&gt;

&lt;P&gt;I was thinking to your question: why you don't use Time Picker?&lt;/P&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 16:25:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Populating-drop-down-with-values-generated-from-a-search/m-p/325863#M40544</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-09-29T16:25:15Z</dc:date>
    </item>
    <item>
      <title>Re: Populating drop down with values generated from a search</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Populating-drop-down-with-values-generated-from-a-search/m-p/325864#M40545</link>
      <description>&lt;P&gt;Hi Guissepe,&lt;/P&gt;

&lt;P&gt;For the  purpose of the task, drop down seems to be the best option. I found an example of someone trying to achieve the same thing as me, but the bit im getting confused on is the index bit:&lt;/P&gt;

&lt;P&gt;index=main sourcetype=mainperfomance ChannelCode=* | head 1000 | stats count by ChannelCode | fields - count&lt;/P&gt;

&lt;P&gt;Im basically trying to do the same thing, but i want to return all the dates &lt;/P&gt;</description>
      <pubDate>Wed, 25 Oct 2017 12:32:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Populating-drop-down-with-values-generated-from-a-search/m-p/325864#M40545</guid>
      <dc:creator>mahbs</dc:creator>
      <dc:date>2017-10-25T12:32:18Z</dc:date>
    </item>
    <item>
      <title>Re: Populating drop down with values generated from a search</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Populating-drop-down-with-values-generated-from-a-search/m-p/325865#M40546</link>
      <description>&lt;P&gt;Hi mahbs,&lt;BR /&gt;
I used this solution when I didn't have continuous event flow but only events in a few days and using time picker it was possible to select an empty period.&lt;BR /&gt;
If you have continuous events it's better (and easier) to use Time Picker.&lt;BR /&gt;
If you want to help your users, you can set some predefined time intervals (e.g. last 2 days, last 3 days).&lt;BR /&gt;
Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 25 Oct 2017 13:15:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Populating-drop-down-with-values-generated-from-a-search/m-p/325865#M40546</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2017-10-25T13:15:40Z</dc:date>
    </item>
  </channel>
</rss>

