<?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 earliest from string in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/set-earliest-from-string/m-p/372538#M24331</link>
    <description>&lt;P&gt;i have a dashboard,  in the click.value will have a string value (e.g 20182010)&lt;BR /&gt;
and then below have another line chart, but how can i put the token to that search &lt;/P&gt;

&lt;P&gt;e.g &lt;BR /&gt;
index=test earliest=$token_date$&lt;/P&gt;

&lt;P&gt;i think the $token_date need to use strptime to convert and then pass to search. but how?&lt;BR /&gt;
Thanks&lt;/P&gt;</description>
    <pubDate>Sat, 10 Feb 2018 11:36:53 GMT</pubDate>
    <dc:creator>kennethyeung</dc:creator>
    <dc:date>2018-02-10T11:36:53Z</dc:date>
    <item>
      <title>set earliest from string</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/set-earliest-from-string/m-p/372538#M24331</link>
      <description>&lt;P&gt;i have a dashboard,  in the click.value will have a string value (e.g 20182010)&lt;BR /&gt;
and then below have another line chart, but how can i put the token to that search &lt;/P&gt;

&lt;P&gt;e.g &lt;BR /&gt;
index=test earliest=$token_date$&lt;/P&gt;

&lt;P&gt;i think the $token_date need to use strptime to convert and then pass to search. but how?&lt;BR /&gt;
Thanks&lt;/P&gt;</description>
      <pubDate>Sat, 10 Feb 2018 11:36:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/set-earliest-from-string/m-p/372538#M24331</guid>
      <dc:creator>kennethyeung</dc:creator>
      <dc:date>2018-02-10T11:36:53Z</dc:date>
    </item>
    <item>
      <title>Re: set earliest from string</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/set-earliest-from-string/m-p/372539#M24332</link>
      <description>&lt;P&gt;hi @kennethyeung,&lt;/P&gt;

&lt;P&gt;You can use strptime when you click on chart and set token_date.  what is date format of 20182010?&lt;BR /&gt;
Can you please share you sample dashboard xml?&lt;/P&gt;</description>
      <pubDate>Sat, 10 Feb 2018 12:02:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/set-earliest-from-string/m-p/372539#M24332</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2018-02-10T12:02:09Z</dc:date>
    </item>
    <item>
      <title>Re: set earliest from string</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/set-earliest-from-string/m-p/372540#M24333</link>
      <description>&lt;P&gt;Thanks your suggestion, i should eval token instead of eval in the search&lt;BR /&gt;
 strftime(strptime($click.value$,"%Y%m%d"),"%m/%d/%Y:00:00:00")&lt;BR /&gt;
and the in search &lt;/P&gt;

&lt;P&gt;index=$tok_index$ earliest="$tok_date$"&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 18:02:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/set-earliest-from-string/m-p/372540#M24333</guid>
      <dc:creator>kennethyeung</dc:creator>
      <dc:date>2020-09-29T18:02:35Z</dc:date>
    </item>
    <item>
      <title>Re: set earliest from string</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/set-earliest-from-string/m-p/372541#M24334</link>
      <description>&lt;P&gt;So, have you resolved your issue?&lt;/P&gt;</description>
      <pubDate>Sat, 10 Feb 2018 12:48:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/set-earliest-from-string/m-p/372541#M24334</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2018-02-10T12:48:32Z</dc:date>
    </item>
    <item>
      <title>Re: set earliest from string</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/set-earliest-from-string/m-p/372542#M24335</link>
      <description>&lt;P&gt;Is it is &lt;CODE&gt;table&lt;/CODE&gt; or &lt;CODE&gt;chart&lt;/CODE&gt; that you are clicking to get &lt;CODE&gt;20182010&lt;/CODE&gt; as click.value?&lt;/P&gt;</description>
      <pubDate>Sun, 11 Feb 2018 08:37:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/set-earliest-from-string/m-p/372542#M24335</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-02-11T08:37:50Z</dc:date>
    </item>
    <item>
      <title>Re: set earliest from string</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/set-earliest-from-string/m-p/372543#M24336</link>
      <description>&lt;P&gt;Instead of having earliest=$token_date$ in your search, replace it with the following subsearch:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[| makeresults | eval thisdate="$token_date$" | eval earliest=strptime(thisdate, "%Y%d%m") | fields + earliest]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So your example search would instead look like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=test [| makeresults | eval thisdate="$token_date$" | eval earliest=strptime(thisdate, "%Y%d%m") | fields + earliest]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This is all assuming the date format you have is YYYYDDMM which would translate to 20th October 2018 with your example of 20182010.  If the date format will be YYYYMMDD then use this instead:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=test [| makeresults | eval thisdate="$token_date$" | eval earliest=strptime(thisdate, "%Y%m%d") | fields + earliest]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 11 Feb 2018 14:59:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/set-earliest-from-string/m-p/372543#M24336</guid>
      <dc:creator>sashraf</dc:creator>
      <dc:date>2018-02-11T14:59:10Z</dc:date>
    </item>
  </channel>
</rss>

