<?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 Set the latest date from search as the default value in dropdown with submit button? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Set-the-latest-date-from-search-as-the-default-value-in-dropdown/m-p/451460#M78288</link>
    <description>&lt;P&gt;I want to set the latest date from the search as the default value in dropdown, and the submit must be set to true. &lt;BR /&gt;
Here's my code so far:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  &amp;lt;search&amp;gt;
    &amp;lt;query&amp;gt;index="test_summary_trial" 
|dedup DATE
|eval DATE_ARRANGED1 = strptime(DATE, "%m/%d/%Y")
|sort - ORDER_DATE_ARRANGED1
|stats first(DATE) as DATE_LATEST
      &amp;lt;/query&amp;gt;
    &amp;lt;done&amp;gt;
      &amp;lt;set token="currentDate"&amp;gt;$result.DATE_LATEST$&amp;lt;/set&amp;gt;
    &amp;lt;/done&amp;gt;
  &amp;lt;/search&amp;gt;
  &amp;lt;fieldset submitButton="true"&amp;gt;
    &amp;lt;input type="dropdown" token="date"&amp;gt;
      &amp;lt;label&amp;gt; Date&amp;lt;/label&amp;gt;
      &amp;lt;fieldForLabel&amp;gt;DATE&amp;lt;/fieldForLabel&amp;gt;
      &amp;lt;fieldForValue&amp;gt;DATE&amp;lt;/fieldForValue&amp;gt;
      &amp;lt;search&amp;gt;
        &amp;lt;query&amp;gt;index="test_summary_trial" 
|dedup DATE
|eval ORDER_DATE_ARRANGED1 = strptime(DATE, "%m/%d/%Y")
|sort - ORDER_DATE_ARRANGED1
|table DATE&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;default&amp;gt;$currentDate$&amp;lt;/default&amp;gt;
    &amp;lt;/input&amp;gt;
&amp;lt;/fieldset&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The problem is that whenever i set the submitButton to "true", the default value ($currentDate$ token) i set for the Date dropdown  isn't working. &lt;BR /&gt;
Is there a way where I can still set the default value through the token even if the submitButton is set to true? &lt;BR /&gt;
or&lt;BR /&gt;
Is there a more efficient way to set the latest date from search as a default value even if the submitButton is set to true? &lt;BR /&gt;
Thank you for your help in advance &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 07 Sep 2018 10:21:32 GMT</pubDate>
    <dc:creator>patricianaguit</dc:creator>
    <dc:date>2018-09-07T10:21:32Z</dc:date>
    <item>
      <title>Set the latest date from search as the default value in dropdown with submit button?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Set-the-latest-date-from-search-as-the-default-value-in-dropdown/m-p/451460#M78288</link>
      <description>&lt;P&gt;I want to set the latest date from the search as the default value in dropdown, and the submit must be set to true. &lt;BR /&gt;
Here's my code so far:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  &amp;lt;search&amp;gt;
    &amp;lt;query&amp;gt;index="test_summary_trial" 
|dedup DATE
|eval DATE_ARRANGED1 = strptime(DATE, "%m/%d/%Y")
|sort - ORDER_DATE_ARRANGED1
|stats first(DATE) as DATE_LATEST
      &amp;lt;/query&amp;gt;
    &amp;lt;done&amp;gt;
      &amp;lt;set token="currentDate"&amp;gt;$result.DATE_LATEST$&amp;lt;/set&amp;gt;
    &amp;lt;/done&amp;gt;
  &amp;lt;/search&amp;gt;
  &amp;lt;fieldset submitButton="true"&amp;gt;
    &amp;lt;input type="dropdown" token="date"&amp;gt;
      &amp;lt;label&amp;gt; Date&amp;lt;/label&amp;gt;
      &amp;lt;fieldForLabel&amp;gt;DATE&amp;lt;/fieldForLabel&amp;gt;
      &amp;lt;fieldForValue&amp;gt;DATE&amp;lt;/fieldForValue&amp;gt;
      &amp;lt;search&amp;gt;
        &amp;lt;query&amp;gt;index="test_summary_trial" 
|dedup DATE
|eval ORDER_DATE_ARRANGED1 = strptime(DATE, "%m/%d/%Y")
|sort - ORDER_DATE_ARRANGED1
|table DATE&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;default&amp;gt;$currentDate$&amp;lt;/default&amp;gt;
    &amp;lt;/input&amp;gt;
&amp;lt;/fieldset&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The problem is that whenever i set the submitButton to "true", the default value ($currentDate$ token) i set for the Date dropdown  isn't working. &lt;BR /&gt;
Is there a way where I can still set the default value through the token even if the submitButton is set to true? &lt;BR /&gt;
or&lt;BR /&gt;
Is there a more efficient way to set the latest date from search as a default value even if the submitButton is set to true? &lt;BR /&gt;
Thank you for your help in advance &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Sep 2018 10:21:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Set-the-latest-date-from-search-as-the-default-value-in-dropdown/m-p/451460#M78288</guid>
      <dc:creator>patricianaguit</dc:creator>
      <dc:date>2018-09-07T10:21:32Z</dc:date>
    </item>
    <item>
      <title>Re: Set the latest date from search as the default value in dropdown with submit button?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Set-the-latest-date-from-search-as-the-default-value-in-dropdown/m-p/451461#M78289</link>
      <description>&lt;P&gt;@patricianaguit&lt;/P&gt;

&lt;P&gt;Instead of using different search for setting default value can you please try SelectFirstChoice with existing dropdown search?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;selectFirstChoice&amp;gt;true&amp;lt;/selectFirstChoice&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;eg.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;fieldset submitButton="true"&amp;gt;
     &amp;lt;input type="dropdown" token="date"&amp;gt;
       &amp;lt;label&amp;gt; Date&amp;lt;/label&amp;gt;

       &amp;lt;selectFirstChoice&amp;gt;true&amp;lt;/selectFirstChoice&amp;gt;

       &amp;lt;fieldForLabel&amp;gt;DATE&amp;lt;/fieldForLabel&amp;gt;
       &amp;lt;fieldForValue&amp;gt;DATE&amp;lt;/fieldForValue&amp;gt;
       &amp;lt;search&amp;gt;
         &amp;lt;query&amp;gt;index="test_summary_trial" 
         |dedup DATE
         |eval ORDER_DATE_ARRANGED1 = strptime(DATE, "%m/%d/%Y")
         |sort - ORDER_DATE_ARRANGED1
         |table DATE&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;/fieldset&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 07 Sep 2018 14:29:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Set-the-latest-date-from-search-as-the-default-value-in-dropdown/m-p/451461#M78289</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2018-09-07T14:29:11Z</dc:date>
    </item>
    <item>
      <title>Re: Set the latest date from search as the default value in dropdown with submit button?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Set-the-latest-date-from-search-as-the-default-value-in-dropdown/m-p/451462#M78290</link>
      <description>&lt;P&gt;thank you &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; this worked for me!&lt;/P&gt;</description>
      <pubDate>Tue, 11 Sep 2018 09:30:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Set-the-latest-date-from-search-as-the-default-value-in-dropdown/m-p/451462#M78290</guid>
      <dc:creator>patricianaguit</dc:creator>
      <dc:date>2018-09-11T09:30:45Z</dc:date>
    </item>
    <item>
      <title>Re: Set the latest date from search as the default value in dropdown with submit button?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Set-the-latest-date-from-search-as-the-default-value-in-dropdown/m-p/451463#M78291</link>
      <description>&lt;P&gt;@patricianaguit Glad to help you &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;/P&gt;</description>
      <pubDate>Tue, 11 Sep 2018 12:01:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Set-the-latest-date-from-search-as-the-default-value-in-dropdown/m-p/451463#M78291</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2018-09-11T12:01:35Z</dc:date>
    </item>
  </channel>
</rss>

