<?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: Default Date XML in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Default-Date-XML/m-p/162255#M9983</link>
    <description>&lt;P&gt;What if I want 5 days before today and today  in my dropdown?&lt;BR /&gt;
could you please help me?&lt;/P&gt;</description>
    <pubDate>Thu, 14 Jan 2016 22:34:49 GMT</pubDate>
    <dc:creator>jossplacencia</dc:creator>
    <dc:date>2016-01-14T22:34:49Z</dc:date>
    <item>
      <title>Default Date XML</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Default-Date-XML/m-p/162252#M9980</link>
      <description>&lt;P&gt;Hi, &lt;/P&gt;

&lt;P&gt;I am trying to create a dashboard which I can show different dashboards in one by changing the date range and other parameters. Everything is working fine, but there is one problem am trying to solve. The problem is I want to have a default date of Today's date (for the End Date) and 30 days before today's date (for starting Date). My dashboard is calling a stored procedure in the database and it has three parameters to run successfully. Here is part of my XML: &lt;/P&gt;

&lt;P&gt;&lt;INPUT type="text" token="StartDate" allowsoftsubmit="false" /&gt;&lt;BR /&gt;
    &lt;DEFAULT&gt;04/01/2014&lt;/DEFAULT&gt;&lt;BR /&gt;
    &lt;LABEL&gt;Select a Start Date:&lt;/LABEL&gt;&lt;BR /&gt;
  &lt;BR /&gt;
   &lt;INPUT type="text" token="EndDate" allowsoftsubmit="false" /&gt;&lt;BR /&gt;
    &lt;DEFAULT&gt;05/01/2014&lt;/DEFAULT&gt;&lt;BR /&gt;
     &lt;LABEL&gt;Select a End Date:&lt;/LABEL&gt;&lt;BR /&gt;
  &lt;/P&gt;

&lt;P&gt;So, how can I set up the EndDate to be Today's date and the StartDate to be 30 days before today's date??&lt;/P&gt;

&lt;P&gt;Any help or suggestion is appreciated &lt;/P&gt;

&lt;P&gt;Thanks &lt;/P&gt;</description>
      <pubDate>Tue, 13 May 2014 16:21:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Default-Date-XML/m-p/162252#M9980</guid>
      <dc:creator>hxa27</dc:creator>
      <dc:date>2014-05-13T16:21:53Z</dc:date>
    </item>
    <item>
      <title>Re: Default Date XML</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Default-Date-XML/m-p/162253#M9981</link>
      <description>&lt;P&gt;The time range picker does not work because of the time format differences between the database and Splunk. so, the  answer you posted won't work in my case&lt;/P&gt;</description>
      <pubDate>Tue, 13 May 2014 16:57:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Default-Date-XML/m-p/162253#M9981</guid>
      <dc:creator>hxa27</dc:creator>
      <dc:date>2014-05-13T16:57:42Z</dc:date>
    </item>
    <item>
      <title>Re: Default Date XML</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Default-Date-XML/m-p/162254#M9982</link>
      <description>&lt;P&gt;I am not aware of any option to assign dynamic value to input of type text. One workaround could be to convert these text input to dropdown input and run a query to get the values. That way it would be dynamic and you can control the format. An example would be like this. [In Splunk 5.x, the value should be selected by default in the dropdown. In Splunk 6.0, it will not select any value and user would have to select a value. In Splunk 6.0.1 onwards, you would have to add &lt;CODE&gt;&amp;lt;selectFirstChoice&amp;gt;true&amp;lt;/selectFirstChoice&amp;gt;&lt;/CODE&gt;  to the dropdown inputs to select the value by default. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form&amp;gt;
  &amp;lt;label&amp;gt;Test&amp;lt;/label&amp;gt;
  &amp;lt;fieldset&amp;gt;
  &amp;lt;input type="dropdown" token="startdate"&amp;gt;
    &amp;lt;label&amp;gt;StartDate&amp;lt;/label&amp;gt;
    &amp;lt;populatingSearch fieldForValue="startdate" fieldForLabel="startdate"&amp;gt;
      &amp;lt;![CDATA[|stats count | eval startdate=strftime(now(),"%m/%d/%Y") | table startdate ]]&amp;gt;
    &amp;lt;/populatingSearch&amp;gt;
  &amp;lt;/input&amp;gt;
    &amp;lt;input type="dropdown" token="enddate"&amp;gt;
    &amp;lt;label&amp;gt;EndDate&amp;lt;/label&amp;gt;
    &amp;lt;populatingSearch fieldForValue="enddate" fieldForLabel="enddate"&amp;gt;
      &amp;lt;![CDATA[|stats count | eval enddate=strftime(relative_time(now(),"-30d"),"%m/%d/%Y") | table enddate ]]&amp;gt;
    &amp;lt;/populatingSearch&amp;gt;
  &amp;lt;/input&amp;gt;
&amp;lt;/fieldset&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;table&amp;gt;
      &amp;lt;searchString&amp;gt;index=_internal | stats count by sourcetype&amp;lt;/searchString&amp;gt;
      &amp;lt;earliestTime&amp;gt;-5m@m&amp;lt;/earliestTime&amp;gt;
    &amp;lt;/table&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 13 May 2014 19:32:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Default-Date-XML/m-p/162254#M9982</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-05-13T19:32:35Z</dc:date>
    </item>
    <item>
      <title>Re: Default Date XML</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Default-Date-XML/m-p/162255#M9983</link>
      <description>&lt;P&gt;What if I want 5 days before today and today  in my dropdown?&lt;BR /&gt;
could you please help me?&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jan 2016 22:34:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Default-Date-XML/m-p/162255#M9983</guid>
      <dc:creator>jossplacencia</dc:creator>
      <dc:date>2016-01-14T22:34:49Z</dc:date>
    </item>
  </channel>
</rss>

