<?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: How to set two tokens off one dropdown in dashboard? in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-set-two-tokens-off-one-dropdown-in-dashboard/m-p/408735#M26815</link>
    <description>&lt;P&gt;Okay, when designing complex interactions, you need to make sure that you avoid what is called a "race" condition - where A changes B, which changes A again.&lt;/P&gt;

&lt;P&gt;Second, if your token $application$ isn't going to be manipulated by the dropdown, then it doesn't need to be an input... it can just be a naked token.  If it &lt;EM&gt;is&lt;/EM&gt; going to be manipulated by the dropdown, then the dropdown should have a source query.  &lt;/P&gt;

&lt;P&gt;We're going to assume that the source query is there, but you've deleted it to simplify the presentation of your question. If that's the case, you just need a &lt;CODE&gt;&amp;lt;change&amp;gt;&lt;/CODE&gt; condition on the application dropdown to reset your subsearch.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;fieldset&amp;gt;
  &amp;lt;input type="dropdown" token="application" searchWhenChanged="true"&amp;gt;
    &amp;lt;query&amp;gt;your search that populates dropdown&amp;lt;/query&amp;gt;
    &amp;lt;fieldForLabel&amp;gt;&amp;lt;/fieldForLabel&amp;gt;
    &amp;lt;fieldForValue&amp;gt;&amp;lt;/fieldForValue&amp;gt;
    &amp;lt;change&amp;gt;
      &amp;lt;set token="ip"&amp;gt;([subsearch stuff | where application="$value$" | return 1000 IP_Address])&amp;lt;/set&amp;gt;
    &amp;lt;/change&amp;gt;
  &amp;lt;/input&amp;gt;
&amp;lt;/fieldset&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;HR /&gt;

&lt;P&gt;updated &lt;CODE&gt;$application$&lt;/CODE&gt; to &lt;CODE&gt;$value$&lt;/CODE&gt; as per best practices suggestion from @niketnilay&lt;/P&gt;</description>
    <pubDate>Mon, 25 Jun 2018 16:38:37 GMT</pubDate>
    <dc:creator>DalJeanis</dc:creator>
    <dc:date>2018-06-25T16:38:37Z</dc:date>
    <item>
      <title>How to set two tokens off one dropdown in dashboard?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-set-two-tokens-off-one-dropdown-in-dashboard/m-p/408734#M26814</link>
      <description>&lt;P&gt;New fun dashboarding issue. I'm trying to set two different tokens off one dropdown. Is this possible? &lt;BR /&gt;
I have a dropdown input with a token called &lt;CODE&gt;$application$&lt;/CODE&gt;. I have one dashboard that summarizes things by IP Address and the drilldown for that is set based on a condition. If you click on the Total at the bottom of the table it will set one thing, otherwise it goes for the &lt;CODE&gt;$click.value$&lt;/CODE&gt;. This drives a second dashboard that uses a kvstore lookup which is prefiltered using a rather clever (I thought anyway) subsearch to set the where clause. This subsearch uses &lt;CODE&gt;$application$&lt;/CODE&gt; in it's function narrow the list of IP Addresses it is initially looking at. I'm trying to make it so if I change the dropdown pointing to $application$ I can get it to update the search and rerun it.&lt;/P&gt;

&lt;P&gt;So this looks something like this right now:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;init&amp;gt;
  &amp;lt;set token="ip"&amp;gt;([subsearch stuff | where application="$application$" | return 1000 IP_Address])&amp;lt;/set&amp;gt;
&amp;lt;/init&amp;gt;
&amp;lt;input type="dropdown" token="application" searchWhenChanged="true"&amp;gt;
&amp;lt;/input&amp;gt;
&amp;lt;table&amp;gt;
  &amp;lt;title&amp;gt;Search 1 - By IP address&amp;lt;/title&amp;gt;
  &amp;lt;search&amp;gt;some search here | where application=$application$ | stats count by IP_Address 
          | addcoltotals labelfield="IP_Address"&amp;lt;/search&amp;gt;
  &amp;lt;drilldown&amp;gt;
    &amp;lt;condition match="match('click.value', &amp;amp;quot;Total&amp;amp;quot;)"&amp;gt;
      &amp;lt;set token="ip"&amp;gt;([subsearch stuff | where application="$application$" | return 1000 IP_Address])&amp;lt;/set&amp;gt;
    &amp;lt;/condition&amp;gt;
    &amp;lt;condition&amp;gt;
      &amp;lt;set token="ip"&amp;gt;$click.value$&amp;lt;/set&amp;gt;
      &amp;lt;eval token="ip"&amp;gt;"IP_Address="+$ip$&amp;lt;/eval&amp;gt;
    &amp;lt;/condition&amp;gt;
  &amp;lt;/drilldown&amp;gt;
&amp;lt;/table&amp;gt;
&amp;lt;table&amp;gt;
  &amp;lt;title&amp;gt;Search 2 - Details&amp;lt;/title&amp;gt;
  &amp;lt;search&amp;gt;| inputlookup kvstorelookup where $ip$ | do some stuff&amp;lt;/search&amp;gt;
&amp;lt;/table&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So as of right now, as long as I don't change application, I can get Search 1 to affect Search 2 to my hearts content. It will happily switch the value back and forth between &lt;CODE&gt;IP_Address=someip&lt;/CODE&gt; and the subsearch &lt;CODE&gt;([subsearch stuff | where application="$application$" | return 1000 IP_Address])&lt;/CODE&gt; but when I change the value of &lt;CODE&gt;$application$&lt;/CODE&gt; I have to reclick "Total" in Search 1 in order to update the value of &lt;CODE&gt;$application$&lt;/CODE&gt; in search two. Effectively what I would like to do is when you change the value of &lt;CODE&gt;$application$&lt;/CODE&gt; have it overwrite the value of &lt;CODE&gt;$ip$&lt;/CODE&gt; back to the subsearch value with the new application defined.&lt;/P&gt;

&lt;P&gt;Oh, the reason I am using the where clause at all on the kvstore is without this the search will take 3x as long (45 seconds instead of 15 seconds). And then once I overwrite the value of &lt;CODE&gt;$ip$&lt;/CODE&gt; to just a single IP it will reduce that further down to a ~3 second search. This greatly enhances user experience, if I can just get the last piece to work.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jun 2018 15:47:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-set-two-tokens-off-one-dropdown-in-dashboard/m-p/408734#M26814</guid>
      <dc:creator>fairje</dc:creator>
      <dc:date>2018-06-25T15:47:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to set two tokens off one dropdown in dashboard?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-set-two-tokens-off-one-dropdown-in-dashboard/m-p/408735#M26815</link>
      <description>&lt;P&gt;Okay, when designing complex interactions, you need to make sure that you avoid what is called a "race" condition - where A changes B, which changes A again.&lt;/P&gt;

&lt;P&gt;Second, if your token $application$ isn't going to be manipulated by the dropdown, then it doesn't need to be an input... it can just be a naked token.  If it &lt;EM&gt;is&lt;/EM&gt; going to be manipulated by the dropdown, then the dropdown should have a source query.  &lt;/P&gt;

&lt;P&gt;We're going to assume that the source query is there, but you've deleted it to simplify the presentation of your question. If that's the case, you just need a &lt;CODE&gt;&amp;lt;change&amp;gt;&lt;/CODE&gt; condition on the application dropdown to reset your subsearch.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;fieldset&amp;gt;
  &amp;lt;input type="dropdown" token="application" searchWhenChanged="true"&amp;gt;
    &amp;lt;query&amp;gt;your search that populates dropdown&amp;lt;/query&amp;gt;
    &amp;lt;fieldForLabel&amp;gt;&amp;lt;/fieldForLabel&amp;gt;
    &amp;lt;fieldForValue&amp;gt;&amp;lt;/fieldForValue&amp;gt;
    &amp;lt;change&amp;gt;
      &amp;lt;set token="ip"&amp;gt;([subsearch stuff | where application="$value$" | return 1000 IP_Address])&amp;lt;/set&amp;gt;
    &amp;lt;/change&amp;gt;
  &amp;lt;/input&amp;gt;
&amp;lt;/fieldset&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;HR /&gt;

&lt;P&gt;updated &lt;CODE&gt;$application$&lt;/CODE&gt; to &lt;CODE&gt;$value$&lt;/CODE&gt; as per best practices suggestion from @niketnilay&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jun 2018 16:38:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-set-two-tokens-off-one-dropdown-in-dashboard/m-p/408735#M26815</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2018-06-25T16:38:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to set two tokens off one dropdown in dashboard?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-set-two-tokens-off-one-dropdown-in-dashboard/m-p/408736#M26816</link>
      <description>&lt;P&gt;@fairje seems like you are missing the code for dropdown input &lt;CODE&gt;application&lt;/CODE&gt;. However, to answer your question, on change of the dropdown value you can set multiple tokens using &lt;CODE&gt;&amp;lt;change&amp;gt;&lt;/CODE&gt; event handler. The code would look something like the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; &amp;lt;input type="dropdown" token="application" searchWhenChanged="true"&amp;gt;
 ...
 ...
         &amp;lt;change&amp;gt;
               &amp;lt;set token="ip"&amp;gt;([subsearch stuff | where application="$value$" | return 1000 IP_Address])&amp;lt;/set&amp;gt;
         &amp;lt;/change&amp;gt;
 &amp;lt;/input&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;PS: Predefined tokens &lt;CODE&gt;$value$&lt;/CODE&gt; and &lt;CODE&gt;$label$&lt;/CODE&gt; inside the &lt;CODE&gt;&amp;lt;change&amp;gt;&lt;/CODE&gt; event handlers are used to access selected value and label respective in the dropdown. Refer to documentation: &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Viz/EventHandlerReference#Event_handler_element"&gt;http://docs.splunk.com/Documentation/Splunk/latest/Viz/EventHandlerReference#Event_handler_element&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jun 2018 16:43:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-set-two-tokens-off-one-dropdown-in-dashboard/m-p/408736#M26816</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-06-25T16:43:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to set two tokens off one dropdown in dashboard?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-set-two-tokens-off-one-dropdown-in-dashboard/m-p/408737#M26817</link>
      <description>&lt;P&gt;@DalJeanis just noticed your answer after posting mine... it should be &lt;CODE&gt;$value$&lt;/CODE&gt; inside the &lt;CODE&gt;&amp;lt;change&amp;gt;&lt;/CODE&gt; event handler.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jun 2018 16:46:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-set-two-tokens-off-one-dropdown-in-dashboard/m-p/408737#M26817</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-06-25T16:46:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to set two tokens off one dropdown in dashboard?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-set-two-tokens-off-one-dropdown-in-dashboard/m-p/408738#M26818</link>
      <description>&lt;P&gt;Ah, I somehow totally overlooked this section of the documentation when I was scratching my head over how to do it. This is exactly what I was looking for!&lt;/P&gt;

&lt;P&gt;Yeah, I had left off the excess code since I was trying not to flood the question with a giant wall of text and keep things simpler to understand what I was seeking.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jun 2018 20:00:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-set-two-tokens-off-one-dropdown-in-dashboard/m-p/408738#M26818</guid>
      <dc:creator>fairje</dc:creator>
      <dc:date>2018-06-25T20:00:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to set two tokens off one dropdown in dashboard?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-set-two-tokens-off-one-dropdown-in-dashboard/m-p/408739#M26819</link>
      <description>&lt;P&gt;Thanks for the answer, looks like using the token name &lt;CODE&gt;$application$&lt;/CODE&gt; also does work, but I assume &lt;CODE&gt;$value$&lt;/CODE&gt; is the better way to go.&lt;/P&gt;

&lt;P&gt;But yes, I just left off data to keep it easier to read what I was actually asking for. My dashboard has a lot more going on than just these elements, but this was ultimately asking the question in the simplest format possible. &lt;/P&gt;</description>
      <pubDate>Mon, 25 Jun 2018 20:03:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-set-two-tokens-off-one-dropdown-in-dashboard/m-p/408739#M26819</guid>
      <dc:creator>fairje</dc:creator>
      <dc:date>2018-06-25T20:03:25Z</dc:date>
    </item>
  </channel>
</rss>

