<?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: Use token in the dropdown choice value in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Use-token-in-the-dropdown-choice-value/m-p/345545#M22492</link>
    <description>&lt;P&gt;Have you set       &lt;CODE&gt;searchWhenChanged = true&lt;/CODE&gt; on the time range picker?&lt;/P&gt;

&lt;P&gt;Alternatively why do you parse the time token in your queries? I suggest you to use a changed snippet that transforms the time string constraint directly into an epoch value that can be used in your queries:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;change&amp;gt;
    &amp;lt;eval token="earliest"&amp;gt;if(isnum($time.earliest$), $time.earliest$, relative_time(now(), $time.earliest$))&amp;lt;/eval&amp;gt;
    &amp;lt;eval token="latest"&amp;gt;if(isnum($time.latest$), $time.latest$, relative_time(now(), $time.latest$))&amp;lt;/eval&amp;gt;
&amp;lt;/change&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You can simply add this to the input definition of your time range picker and use the new tokens $earliest$ and $latest$ for time comparisons. You could also add more tokens and formations, depending on your needs.&lt;/P&gt;

&lt;P&gt;Oh and by the way, in your example (your first query) you also need to escape       &lt;CODE&gt;&amp;gt;&lt;/CODE&gt;  into       &lt;CODE&gt;&amp;amp;gt;&lt;/CODE&gt; . &lt;/P&gt;</description>
    <pubDate>Mon, 05 Feb 2018 10:41:12 GMT</pubDate>
    <dc:creator>bojanisch</dc:creator>
    <dc:date>2018-02-05T10:41:12Z</dc:date>
    <item>
      <title>Use token in the dropdown choice value</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Use-token-in-the-dropdown-choice-value/m-p/345543#M22490</link>
      <description>&lt;P&gt;I have a dropdown with choice values as follows:&lt;BR /&gt;
    &lt;INPUT type="dropdown" token="task_token_t1" id="task_token_t1" searchwhenchanged="true" /&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;        &amp;lt;label&amp;gt;SELECT A TASK NAME&amp;lt;/label&amp;gt;

        &amp;lt;choice value="taskName='aaa' status='COMPLETED'| sort -splunkLogId | eval startDateModified= strptime( startDate, &amp;amp;quot;%Y-%m-%d %H:%M:%S&amp;amp;quot;) | eval newDateFromDash = relative_time($dashboardTime.latest$(), &amp;amp;quot;$dashboardTime.earliest$&amp;amp;quot;)
 | where startDateModified &amp;gt; newDateFromDash | eval runDate = strftime(strptime(startDate, &amp;amp;quot;%Y-%m-%d&amp;amp;quot;),&amp;amp;quot;%Y-%m-%d&amp;amp;quot;) |chart sum(rowCount) over runDate"&amp;gt;aaa&amp;lt;/choice&amp;gt;

        &amp;lt;choice value="taskName='bbb' status='COMPLETED'| sort -splunkLogId |eval startDateModified= strptime( startDate, &amp;amp;quot;%Y-%m-%d %H:%M:%S&amp;amp;quot;) | eval newDateFromDash = relative_time($dashboardTime.latest$(), &amp;amp;quot;$dashboardTime.earliest$&amp;amp;quot;)
 | eval runDate = strftime(strptime(startDate, &amp;amp;quot;%Y-%m-%d&amp;amp;quot;),&amp;amp;quot;%Y-%m-%d&amp;amp;quot;) |chart sum(rowCount) over runDate"&amp;gt;bbb&amp;lt;/choice&amp;gt;
        .....
        &amp;lt;selectFirstChoice&amp;gt;true&amp;lt;/selectFirstChoice&amp;gt;
      &amp;lt;/input&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;"dashboardTime" is nothing but my time select box token. But the choice value is not getting update with the corresponding values of $dashboardTime.latest$ and $dashboardTime.earliest$ instead it is update with the string "$dashboardTime.latest$ " and "$dashboardTime.earliest$".&lt;BR /&gt;
Can anyone please suggest me to do it.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Feb 2018 09:34:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Use-token-in-the-dropdown-choice-value/m-p/345543#M22490</guid>
      <dc:creator>karthi25</dc:creator>
      <dc:date>2018-02-05T09:34:12Z</dc:date>
    </item>
    <item>
      <title>Re: Use token in the dropdown choice value</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Use-token-in-the-dropdown-choice-value/m-p/345544#M22491</link>
      <description>&lt;P&gt;also share my time select box query to understand better&lt;/P&gt;</description>
      <pubDate>Mon, 05 Feb 2018 09:39:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Use-token-in-the-dropdown-choice-value/m-p/345544#M22491</guid>
      <dc:creator>493669</dc:creator>
      <dc:date>2018-02-05T09:39:58Z</dc:date>
    </item>
    <item>
      <title>Re: Use token in the dropdown choice value</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Use-token-in-the-dropdown-choice-value/m-p/345545#M22492</link>
      <description>&lt;P&gt;Have you set       &lt;CODE&gt;searchWhenChanged = true&lt;/CODE&gt; on the time range picker?&lt;/P&gt;

&lt;P&gt;Alternatively why do you parse the time token in your queries? I suggest you to use a changed snippet that transforms the time string constraint directly into an epoch value that can be used in your queries:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;change&amp;gt;
    &amp;lt;eval token="earliest"&amp;gt;if(isnum($time.earliest$), $time.earliest$, relative_time(now(), $time.earliest$))&amp;lt;/eval&amp;gt;
    &amp;lt;eval token="latest"&amp;gt;if(isnum($time.latest$), $time.latest$, relative_time(now(), $time.latest$))&amp;lt;/eval&amp;gt;
&amp;lt;/change&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You can simply add this to the input definition of your time range picker and use the new tokens $earliest$ and $latest$ for time comparisons. You could also add more tokens and formations, depending on your needs.&lt;/P&gt;

&lt;P&gt;Oh and by the way, in your example (your first query) you also need to escape       &lt;CODE&gt;&amp;gt;&lt;/CODE&gt;  into       &lt;CODE&gt;&amp;amp;gt;&lt;/CODE&gt; . &lt;/P&gt;</description>
      <pubDate>Mon, 05 Feb 2018 10:41:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Use-token-in-the-dropdown-choice-value/m-p/345545#M22492</guid>
      <dc:creator>bojanisch</dc:creator>
      <dc:date>2018-02-05T10:41:12Z</dc:date>
    </item>
  </channel>
</rss>

