<?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: set time range token with multiselect input in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/set-time-range-token-with-multiselect-input/m-p/693939#M56820</link>
    <description>&lt;P&gt;Your question is a little confusing. You have mentioned the same token twice. Also, please can you clarify what you want if three different years are chosen? Also, how are you going to use the token(s) as this makes a difference to how they might be set up?&lt;/P&gt;</description>
    <pubDate>Mon, 22 Jul 2024 08:29:49 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2024-07-22T08:29:49Z</dc:date>
    <item>
      <title>set time range token with multiselect input</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/set-time-range-token-with-multiselect-input/m-p/693923#M56818</link>
      <description>&lt;P&gt;I have a mutiselect input like this&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;input type="multiselect" token="year"&amp;gt;
&amp;lt;label&amp;gt;Year&amp;lt;/label&amp;gt;
&amp;lt;choice value="*"&amp;gt;All&amp;lt;/choice&amp;gt;
&amp;lt;delimiter&amp;gt; OR year=&amp;lt;/delimiter&amp;gt;
&amp;lt;fieldForLabel&amp;gt;year&amp;lt;/fieldForLabel&amp;gt;
&amp;lt;fieldForValue&amp;gt;year&amp;lt;/fieldForValue&amp;gt;
&amp;lt;search&amp;gt;
&amp;lt;query&amp;gt;| inputlookup supported_years.csv
| dedup year
| table year&amp;lt;/query&amp;gt;
&amp;lt;/search&amp;gt;
&amp;lt;default&amp;gt;2023&amp;lt;/default&amp;gt;
&amp;lt;initialValue&amp;gt;2023&amp;lt;/initialValue&amp;gt;
&amp;lt;/input&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;I want to set the time range token to the result of the input selection above. If 2023 was chosen, the token value for $timeRangeEarliest$ should be 2023/01/01 and the token value for&amp;nbsp;$timeRangeLastet$ should be 2023/12/31.&amp;nbsp; If 2021 and 2023 was chosen, the token value for $timeRangeEarliest$ should be 2021/01/01 and the token value for&amp;nbsp;$timeRangeLastet$ should be 2023/12/31. Etc.&lt;BR /&gt;&lt;BR /&gt;I want to use this two tokens for time range in search. Don't know how to do it. Please help. Many thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jul 2024 08:34:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/set-time-range-token-with-multiselect-input/m-p/693923#M56818</guid>
      <dc:creator>Zero</dc:creator>
      <dc:date>2024-07-22T08:34:02Z</dc:date>
    </item>
    <item>
      <title>Re: set time range token with multiselect input</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/set-time-range-token-with-multiselect-input/m-p/693939#M56820</link>
      <description>&lt;P&gt;Your question is a little confusing. You have mentioned the same token twice. Also, please can you clarify what you want if three different years are chosen? Also, how are you going to use the token(s) as this makes a difference to how they might be set up?&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jul 2024 08:29:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/set-time-range-token-with-multiselect-input/m-p/693939#M56820</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-07-22T08:29:49Z</dc:date>
    </item>
    <item>
      <title>Re: set time range token with multiselect input</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/set-time-range-token-with-multiselect-input/m-p/693941#M56821</link>
      <description>&lt;P&gt;Thanks for your reply.&lt;/P&gt;
&lt;P&gt;Sorry for the two identical token name, this was a typo and I have corrected it.&lt;/P&gt;
&lt;P&gt;If there are three or more years, I want to find the earliest year and the latest year, and use the date as tokens. (I just want to find the smallest time range that covers all those years.) And I want to use the tokens for time range of searches in dashboard. Like this:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;&amp;lt;search&amp;gt;
&amp;lt;query&amp;gt;| index=abc&amp;lt;/query&amp;gt;
&amp;lt;earliest&amp;gt;$timeRangeEarliest$&amp;lt;/earliest&amp;gt;
&amp;lt;latest&amp;gt;$timeRangeLastet$&amp;lt;/latest&amp;gt;
&amp;lt;/search&amp;gt;&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 22 Jul 2024 08:50:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/set-time-range-token-with-multiselect-input/m-p/693941#M56821</guid>
      <dc:creator>Zero</dc:creator>
      <dc:date>2024-07-22T08:50:14Z</dc:date>
    </item>
    <item>
      <title>Re: set time range token with multiselect input</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/set-time-range-token-with-multiselect-input/m-p/693945#M56823</link>
      <description>&lt;P&gt;Try something like this - note that is doesn't deal with All - for that (should you decide it is necessary), you would have to do something a bit more complicated&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;input type="multiselect" token="year"&amp;gt;
&amp;lt;label&amp;gt;Year&amp;lt;/label&amp;gt;
&amp;lt;fieldForLabel&amp;gt;year&amp;lt;/fieldForLabel&amp;gt;
&amp;lt;fieldForValue&amp;gt;year&amp;lt;/fieldForValue&amp;gt;
&amp;lt;search&amp;gt;
&amp;lt;query&amp;gt;| inputlookup supported_years.csv
| dedup year
| table year&amp;lt;/query&amp;gt;
&amp;lt;/search&amp;gt;
&amp;lt;default&amp;gt;2023&amp;lt;/default&amp;gt;
&amp;lt;initialValue&amp;gt;2023&amp;lt;/initialValue&amp;gt;
      &amp;lt;change&amp;gt;
        &amp;lt;eval token="earliest"&amp;gt;mvindex(mvsort($form.year$),0)&amp;lt;/eval&amp;gt;
        &amp;lt;eval token="latest"&amp;gt;mvindex(mvsort($form.year$),mvcount($form.year$)-1)&amp;lt;/eval&amp;gt;
        &amp;lt;eval token="timeRangeEarliest"&amp;gt;strptime($earliest$."0101","%Y%m%d")&amp;lt;/eval&amp;gt;
        &amp;lt;eval token="timeRangeLatest"&amp;gt;relative_time(strptime(($latest$)."0101","%Y%m%d"),"+1y")&amp;lt;/eval&amp;gt;
      &amp;lt;/change&amp;gt;
&amp;lt;/input&amp;gt;&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 22 Jul 2024 09:33:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/set-time-range-token-with-multiselect-input/m-p/693945#M56823</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-07-22T09:33:27Z</dc:date>
    </item>
  </channel>
</rss>

