<?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: Conditional Dropdown based on date in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Conditional-Dropdown-based-on-date/m-p/404088#M42252</link>
    <description>&lt;P&gt;&lt;CODE&gt;&amp;lt;condition&amp;gt;&lt;/CODE&gt; is like simple if-else,&lt;BR /&gt;
your second &lt;CODE&gt;&amp;lt;condition&amp;gt;&lt;/CODE&gt; is not containing any rules&lt;/P&gt;

&lt;P&gt;if your first  &lt;CODE&gt;&amp;lt;condition&amp;gt;&lt;/CODE&gt; is &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  &amp;lt;condition match="$value$!=$todate$"&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;then your second &lt;CODE&gt;&amp;lt;condition&amp;gt;&lt;/CODE&gt; should be,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; &amp;lt;condition match="$value$==$todate$"&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 11 Apr 2019 06:23:16 GMT</pubDate>
    <dc:creator>paramagurukarth</dc:creator>
    <dc:date>2019-04-11T06:23:16Z</dc:date>
    <item>
      <title>Conditional Dropdown based on date</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Conditional-Dropdown-based-on-date/m-p/404084#M42248</link>
      <description>&lt;P&gt;Hello experts,&lt;/P&gt;

&lt;P&gt;I have 2 dropdowns in my dashboard.&lt;/P&gt;

&lt;P&gt;1st - Last 7 days (including TODAY)&lt;BR /&gt;
2nd - If I select TODAY in 1st, I need to write a search query on an index to populate values in this dropdown.&lt;BR /&gt;
          If I select any other day, I need to search inputlookup csv file which gets generated everyday at 00:02 (having all the values of last 6 days).&lt;/P&gt;

&lt;P&gt;How can I put this if-else condition to populate 2nd dropdown?&lt;/P&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
Naresh&lt;/P&gt;</description>
      <pubDate>Wed, 10 Apr 2019 07:02:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Conditional-Dropdown-based-on-date/m-p/404084#M42248</guid>
      <dc:creator>nareshinsvu</dc:creator>
      <dc:date>2019-04-10T07:02:09Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Dropdown based on date</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Conditional-Dropdown-based-on-date/m-p/404085#M42249</link>
      <description>&lt;P&gt;User condition statement with on-change event for your dropdown1 and form the search for your dropdown two&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 submitButton="false"&amp;gt;
    &amp;lt;input type="dropdown" token="field0"&amp;gt;
      &amp;lt;label&amp;gt;field0&amp;lt;/label&amp;gt;
      &amp;lt;showClearButton&amp;gt;0&amp;lt;/showClearButton&amp;gt;
      &amp;lt;choice value="today"&amp;gt;Today&amp;lt;/choice&amp;gt;
      &amp;lt;choice value="Day2"&amp;gt;Day 2&amp;lt;/choice&amp;gt;
      &amp;lt;default&amp;gt;today&amp;lt;/default&amp;gt;
      &amp;lt;change&amp;gt;
        &amp;lt;condition label="Today"&amp;gt;
          &amp;lt;set token="search_for_field1"&amp;gt;|rest /services/data/indexes | table coldPath | rename coldPath as title&amp;lt;/set&amp;gt;
        &amp;lt;/condition&amp;gt;
        &amp;lt;condition label="Day 2"&amp;gt;
          &amp;lt;set token="search_for_field1"&amp;gt;|rest /services/data/indexes | table title&amp;lt;/set&amp;gt;          
        &amp;lt;/condition&amp;gt;
      &amp;lt;/change&amp;gt;
    &amp;lt;/input&amp;gt;
    &amp;lt;input type="dropdown" token="field1"&amp;gt;
      &amp;lt;search&amp;gt;
        &amp;lt;query&amp;gt;$search_for_field1$&amp;lt;/query&amp;gt;
      &amp;lt;/search&amp;gt;
      &amp;lt;fieldForLabel&amp;gt;title&amp;lt;/fieldForLabel&amp;gt;
      &amp;lt;fieldForValue&amp;gt;title&amp;lt;/fieldForValue&amp;gt;
    &amp;lt;/input&amp;gt;
  &amp;lt;/fieldset&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 10 Apr 2019 11:25:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Conditional-Dropdown-based-on-date/m-p/404085#M42249</guid>
      <dc:creator>paramagurukarth</dc:creator>
      <dc:date>2019-04-10T11:25:39Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Dropdown based on date</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Conditional-Dropdown-based-on-date/m-p/404086#M42250</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/47134"&gt;@paramagurukarth&lt;/a&gt;ikeyan &lt;/P&gt;

&lt;P&gt;It's a nice idea to write queries during the condition matches. But my Today is not a static value. Below is my code snippet. Somehow my condition is not able to give me results when I use $todate$. I hope it's a minor tweak. Need help please.&lt;/P&gt;

&lt;P&gt;Below I am setting token $todate$ to today's value&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;      &amp;lt;query&amp;gt;| makeresults|eval today=strftime(_time,"%Y-%m-%d")|fields - _time&amp;lt;/query&amp;gt;
 &amp;lt;done&amp;gt;
   &amp;lt;set token="todate"&amp;gt;$result.today$&amp;lt;/set&amp;gt;
 &amp;lt;/done&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And using it in below code snippet. My default value is &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  &amp;lt;input type="dropdown" token="selected_date" searchWhenChanged="true"&amp;gt;
  &amp;lt;label&amp;gt;Select a Date&amp;lt;/label&amp;gt;
  &amp;lt;default&amp;gt;$todate$&amp;lt;/default&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;.&lt;BR /&gt;
.&lt;BR /&gt;
.&lt;BR /&gt;
.&lt;BR /&gt;
          &lt;CONDITION match="$result.value$!=$form.todate$"&gt;&lt;BR /&gt;
          &lt;SET token="selected_T_query"&gt;&lt;BR /&gt;
           | inputlookup  lookup.csv | search Day=$selected_date$ | stats count by TRAN_CAT&lt;BR /&gt;
          &lt;/SET&gt;&lt;BR /&gt;
        &lt;/CONDITION&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 00:04:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Conditional-Dropdown-based-on-date/m-p/404086#M42250</guid>
      <dc:creator>nareshinsvu</dc:creator>
      <dc:date>2020-09-30T00:04:35Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Dropdown based on date</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Conditional-Dropdown-based-on-date/m-p/404087#M42251</link>
      <description>&lt;P&gt;New updates:&lt;/P&gt;

&lt;P&gt;I am able to make it work. But new problem. Only first condition works. 2nd condition is not working.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    &amp;lt;condition match="$value$!=&amp;amp;quot;$todate$&amp;amp;quot;"&amp;gt;
      &amp;lt;unset token="selected_T_query"&amp;gt;&amp;lt;/unset&amp;gt;
      &amp;lt;set token="selected_T_query"&amp;gt;
       | inputlookup  lookup.csv | search Day=$selected_date$ | stats count by TRAN_CAT
      &amp;lt;/set&amp;gt;
    &amp;lt;/condition &amp;gt;

    &amp;lt;condition  &amp;gt;
      &amp;lt;unset token="selected_T_query"&amp;gt;&amp;lt;/unset&amp;gt;
      &amp;lt;set token="selected_T_query"&amp;gt;
      | savedsearch 00Dashboard_All_Lookup  |  stats count by TRAN_CAT 
      &amp;lt;/set&amp;gt;
    &amp;lt;/condition &amp;gt;
      &amp;lt;/change&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 11 Apr 2019 01:50:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Conditional-Dropdown-based-on-date/m-p/404087#M42251</guid>
      <dc:creator>nareshinsvu</dc:creator>
      <dc:date>2019-04-11T01:50:30Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Dropdown based on date</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Conditional-Dropdown-based-on-date/m-p/404088#M42252</link>
      <description>&lt;P&gt;&lt;CODE&gt;&amp;lt;condition&amp;gt;&lt;/CODE&gt; is like simple if-else,&lt;BR /&gt;
your second &lt;CODE&gt;&amp;lt;condition&amp;gt;&lt;/CODE&gt; is not containing any rules&lt;/P&gt;

&lt;P&gt;if your first  &lt;CODE&gt;&amp;lt;condition&amp;gt;&lt;/CODE&gt; is &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  &amp;lt;condition match="$value$!=$todate$"&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;then your second &lt;CODE&gt;&amp;lt;condition&amp;gt;&lt;/CODE&gt; should be,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; &amp;lt;condition match="$value$==$todate$"&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 11 Apr 2019 06:23:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Conditional-Dropdown-based-on-date/m-p/404088#M42252</guid>
      <dc:creator>paramagurukarth</dc:creator>
      <dc:date>2019-04-11T06:23:16Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Dropdown based on date</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Conditional-Dropdown-based-on-date/m-p/404089#M42253</link>
      <description>&lt;P&gt;@nareshinsvu @paramagurukarthikeyan else condition need not have explicit match condition.&lt;/P&gt;

&lt;P&gt;If in the above case default condition block is not getting hit that implies &lt;CODE&gt;$value$!=&amp;amp;quot;$todate$&amp;amp;quot;&lt;/CODE&gt; is always true i.e. Selected &lt;CODE&gt;value&lt;/CODE&gt; token is never equal to &lt;CODE&gt;todate&lt;/CODE&gt; token. Print in the dashboard to confirm the values.&lt;/P&gt;

&lt;P&gt;Add the following code to both condition blocks and display in Dashboard using panel title or something else:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;set token="selectedTokenValue"&amp;gt;$value$&amp;lt;/set&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 11 Apr 2019 07:26:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Conditional-Dropdown-based-on-date/m-p/404089#M42253</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2019-04-11T07:26:50Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Dropdown based on date</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Conditional-Dropdown-based-on-date/m-p/404090#M42254</link>
      <description>&lt;P&gt;Hi @niketnilay &lt;/P&gt;

&lt;P&gt;You are right. My default condition is never hit. I tried to display the values in my dashboard. Result is shown below&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;1st Condition value is 20190411 and default condition value is $selectedTokenValue1$ and Today is 20190411&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;My default condition should pick the value if it is same as $todate$. But it is not hitting as it is read by my 1st condition. How can I avoid this in condition 1?&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2019 13:01:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Conditional-Dropdown-based-on-date/m-p/404090#M42254</guid>
      <dc:creator>nareshinsvu</dc:creator>
      <dc:date>2019-04-11T13:01:42Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Dropdown based on date</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Conditional-Dropdown-based-on-date/m-p/404091#M42255</link>
      <description>&lt;P&gt;@paramagurukarthikeyan  - It didn't help me Mate after making changes to condition2 as you suggested. @niketnilay was right. All my condition matches are going to 1st condition&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2019 13:03:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Conditional-Dropdown-based-on-date/m-p/404091#M42255</guid>
      <dc:creator>nareshinsvu</dc:creator>
      <dc:date>2019-04-11T13:03:08Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Dropdown based on date</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Conditional-Dropdown-based-on-date/m-p/404092#M42256</link>
      <description>&lt;P&gt;It works when I hardcode like below. But I need it dynamic which changes on daily basis&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2019 00:31:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Conditional-Dropdown-based-on-date/m-p/404092#M42256</guid>
      <dc:creator>nareshinsvu</dc:creator>
      <dc:date>2019-04-12T00:31:23Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Dropdown based on date</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Conditional-Dropdown-based-on-date/m-p/404093#M42257</link>
      <description>&lt;P&gt;condition match="$value$!="2019-04-11""&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2019 01:14:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Conditional-Dropdown-based-on-date/m-p/404093#M42257</guid>
      <dc:creator>nareshinsvu</dc:creator>
      <dc:date>2019-04-12T01:14:24Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Dropdown based on date</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Conditional-Dropdown-based-on-date/m-p/404094#M42258</link>
      <description>&lt;P&gt;May be Splunk is not processing the token string $insideDollor$ in a token string.. in that case try adding a JavaScript . In that listen for the value change in the fisrt field token and form the search string based on your value..&lt;/P&gt;

&lt;P&gt;Refer here &lt;A href="http://dev.splunk.com/view/SP-CAAAEW4"&gt;http://dev.splunk.com/view/SP-CAAAEW4&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2019 02:58:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Conditional-Dropdown-based-on-date/m-p/404094#M42258</guid>
      <dc:creator>paramagurukarth</dc:creator>
      <dc:date>2019-04-12T02:58:21Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional Dropdown based on date</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Conditional-Dropdown-based-on-date/m-p/404095#M42259</link>
      <description>&lt;P&gt;It's resolved. Instead of getting $todate$ from outside, &lt;/P&gt;

&lt;P&gt;I tried to create new column with today's date in the 2nd dropdown query. &lt;/P&gt;

&lt;P&gt;And Set it to a token and used it to compare in the conditions. it worked.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2019 05:11:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Conditional-Dropdown-based-on-date/m-p/404095#M42259</guid>
      <dc:creator>nareshinsvu</dc:creator>
      <dc:date>2019-04-12T05:11:03Z</dc:date>
    </item>
  </channel>
</rss>

