<?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 How to select dashboard panel query based on dropdown input selection in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-select-dashboard-panel-query-based-on-dropdown-input/m-p/352899#M22998</link>
    <description>&lt;P&gt;I have a dashboard which contains 2 inputs.  I have 2 separate queries which would run based on the results of the first input.&lt;/P&gt;

&lt;P&gt;&amp;lt; fieldset submitButton="true" autoRun="false"&amp;gt;&lt;BR /&gt;
    &amp;lt; input type="dropdown" token="i_criteria"&amp;gt;&lt;BR /&gt;
      &amp;lt; label&amp;gt;Search Criteria&amp;lt; /label&amp;gt;&lt;BR /&gt;
      &amp;lt; choice value="message_id"&amp;gt;Message ID&amp;lt; /choice&amp;gt;&lt;BR /&gt;
      &amp;lt; choice value="from"&amp;gt;Sender&amp;lt; /choice&amp;gt;&lt;BR /&gt;
      &amp;lt; choice value="sender_domain"&amp;gt;Sender Domain&amp;lt; /choice&amp;gt;&lt;BR /&gt;
       &amp;lt;  choice value="x_mailer"&amp;gt;X-mailer&amp;lt; /choice&amp;gt;&lt;BR /&gt;
    &amp;lt; /input &amp;gt;&lt;BR /&gt;
    &amp;lt; input type="text" token="s_value" searchWhenChanged="false"&amp;gt;&lt;BR /&gt;
      &amp;lt; label&amp;gt;Search Value&amp;lt; /label&amp;gt;&lt;BR /&gt;
    &amp;lt; /input&amp;gt;&lt;/P&gt;

&lt;P&gt;If the user selects Message ID, Sender, or Sender Domain, the first query should run.  If the user selects X-mailer, the second query should run.&lt;/P&gt;

&lt;P&gt;My first query begins with &lt;EM&gt;&amp;lt; query&amp;gt;index=mail eventtype=pps_filter [search index=mail eventtype=pps_filter *&lt;/EM&gt;$i_criteria$!=x_mailer** $i_criteria$=$s_value|s$ | stats count by internal_message_id, host | fields internal_message_id, host].......................&amp;lt; /query&amp;gt;*&lt;/P&gt;

&lt;P&gt;The second query begins with &lt;EM&gt;&amp;lt; query&amp;gt;index=mail eventtype=pps_filter [search index=mail eventtype=pps_filter | join message_id [search index=mail eventtype=mail_details **x_mailer=$s_value|s$&lt;/EM&gt;* | stats count by message_id, x_mailer| fields x_mailer, message_id] | stats count by internal_message_id, host | fields internal_message_id, host]..................&amp;lt; /query&amp;gt;*&lt;/P&gt;

&lt;P&gt;Assistance with this will be greatly appreciated.&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 13:51:57 GMT</pubDate>
    <dc:creator>adamblock2</dc:creator>
    <dc:date>2020-09-29T13:51:57Z</dc:date>
    <item>
      <title>How to select dashboard panel query based on dropdown input selection</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-select-dashboard-panel-query-based-on-dropdown-input/m-p/352899#M22998</link>
      <description>&lt;P&gt;I have a dashboard which contains 2 inputs.  I have 2 separate queries which would run based on the results of the first input.&lt;/P&gt;

&lt;P&gt;&amp;lt; fieldset submitButton="true" autoRun="false"&amp;gt;&lt;BR /&gt;
    &amp;lt; input type="dropdown" token="i_criteria"&amp;gt;&lt;BR /&gt;
      &amp;lt; label&amp;gt;Search Criteria&amp;lt; /label&amp;gt;&lt;BR /&gt;
      &amp;lt; choice value="message_id"&amp;gt;Message ID&amp;lt; /choice&amp;gt;&lt;BR /&gt;
      &amp;lt; choice value="from"&amp;gt;Sender&amp;lt; /choice&amp;gt;&lt;BR /&gt;
      &amp;lt; choice value="sender_domain"&amp;gt;Sender Domain&amp;lt; /choice&amp;gt;&lt;BR /&gt;
       &amp;lt;  choice value="x_mailer"&amp;gt;X-mailer&amp;lt; /choice&amp;gt;&lt;BR /&gt;
    &amp;lt; /input &amp;gt;&lt;BR /&gt;
    &amp;lt; input type="text" token="s_value" searchWhenChanged="false"&amp;gt;&lt;BR /&gt;
      &amp;lt; label&amp;gt;Search Value&amp;lt; /label&amp;gt;&lt;BR /&gt;
    &amp;lt; /input&amp;gt;&lt;/P&gt;

&lt;P&gt;If the user selects Message ID, Sender, or Sender Domain, the first query should run.  If the user selects X-mailer, the second query should run.&lt;/P&gt;

&lt;P&gt;My first query begins with &lt;EM&gt;&amp;lt; query&amp;gt;index=mail eventtype=pps_filter [search index=mail eventtype=pps_filter *&lt;/EM&gt;$i_criteria$!=x_mailer** $i_criteria$=$s_value|s$ | stats count by internal_message_id, host | fields internal_message_id, host].......................&amp;lt; /query&amp;gt;*&lt;/P&gt;

&lt;P&gt;The second query begins with &lt;EM&gt;&amp;lt; query&amp;gt;index=mail eventtype=pps_filter [search index=mail eventtype=pps_filter | join message_id [search index=mail eventtype=mail_details **x_mailer=$s_value|s$&lt;/EM&gt;* | stats count by message_id, x_mailer| fields x_mailer, message_id] | stats count by internal_message_id, host | fields internal_message_id, host]..................&amp;lt; /query&amp;gt;*&lt;/P&gt;

&lt;P&gt;Assistance with this will be greatly appreciated.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 13:51:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-select-dashboard-panel-query-based-on-dropdown-input/m-p/352899#M22998</guid>
      <dc:creator>adamblock2</dc:creator>
      <dc:date>2020-09-29T13:51:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to select dashboard panel query based on dropdown input selection</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-select-dashboard-panel-query-based-on-dropdown-input/m-p/352900#M22999</link>
      <description>&lt;P&gt;Hi @adamblock2,&lt;BR /&gt;
You can use change and condition elements to set up conditional handling of different input values. You can also use a token to represent the query that should run in either case. Depending on the user selection, set that query token to one or the other search strings in your condition elements.&lt;/P&gt;

&lt;P&gt;See &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.5.0/Viz/tokens#Define_tokens_for_conditional_operations_with_form_inputs"&gt;http://docs.splunk.com/Documentation/Splunk/6.5.0/Viz/tokens#Define_tokens_for_conditional_operations_with_form_inputs&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;and&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.5.0/Viz/tokens#Conditional_operations_with_form_inputs"&gt;http://docs.splunk.com/Documentation/Splunk/6.5.0/Viz/tokens#Conditional_operations_with_form_inputs&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;You can also check out the dashboards examples app for more info:&lt;BR /&gt;
&lt;A href="https://splunkbase.splunk.com/app/1603/"&gt;https://splunkbase.splunk.com/app/1603/&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Hope this helps!&lt;/P&gt;</description>
      <pubDate>Thu, 27 Apr 2017 23:22:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-select-dashboard-panel-query-based-on-dropdown-input/m-p/352900#M22999</guid>
      <dc:creator>frobinson_splun</dc:creator>
      <dc:date>2017-04-27T23:22:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to select dashboard panel query based on dropdown input selection</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-select-dashboard-panel-query-based-on-dropdown-input/m-p/352901#M23000</link>
      <description>&lt;P&gt;I think that I might be missing something.&lt;/P&gt;

&lt;P&gt;My dashboard contains&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;A text input which populates the token "s_value"&lt;/LI&gt;
&lt;LI&gt;A dropdown which populates the token "i_criteria"&lt;/LI&gt;
&lt;LI&gt;A dropdown which populates the token "d_status"&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;I updated my i_criteria dropdown to include the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt; change&amp;gt;
        &amp;lt; condition value="x_mailer"&amp;gt;
            &amp;lt; set token="s_query"&amp;gt;index=mail eventtype=pps_filter [search index=mail eventtype=pps_filter | join message_id [search index=mail eventtype=mail_details x_mailer=$s_value|s$ | stats count by message_id, x_mailer| fields x_mailer, message_id] | stats count by internal_message_id, host | fields internal_message_id, host] | iplocation hops_ip | stats max(_time) AS _time, values(delivery_status) AS delivery_status, values(subject) AS subject, values(from) AS from, values(rcpt) AS to, values(sender_domain) AS sender_domain, values(hops_ip) AS infr_ip, values(Country) AS country, values(file_name) AS file_name, values(message_id) AS message_id, values(x_mailer) AS x_mailer  by internal_message_id, host | join message_id [search index=mail eventtype=mail_details x_mailer=$s_value|s$ | stats count by message_id, x_mailer| fields x_mailer, message_id] | search delivery_status=$d_status$ | table _time, delivery_status, subject, from, to, sender_domain, infr_ip, country, file_name, message_id, x_mailer | sort _time&amp;lt; /set&amp;gt;
        &amp;lt; /condition&amp;gt;
        &amp;lt; condition value="message_id"&amp;gt;
            &amp;lt; set token="s_query"&amp;gt;index=mail eventtype=pps_filter [search index=mail eventtype=pps_filter $i_criteria$!=x_mailer $i_criteria$=$s_value|s$ | stats count by internal_message_id, host | fields internal_message_id, host] | iplocation hops_ip | stats max(_time) AS _time, values(delivery_status) AS delivery_status, values(subject) AS subject, values(from) AS from, values(rcpt) AS to, values(sender_domain) AS sender_domain, values(hops_ip) AS infr_ip, values(Country) AS country, values(file_name) AS file_name, values(message_id) AS message_id, values(x_mailer) AS x_mailer  by internal_message_id, host | search delivery_status=$d_status$ | join type=outer message_id [search index=mail eventtype=mail_details | eval x_mailer=if(x_mailer="","NULL",x_mailer) | stats count by message_id,x_mailer | fields message_id, x_mailer] |table _time, delivery_status, subject, from, to, sender_domain, infr_ip, country, file_name, message_id, x_mailer | sort _time&amp;lt; /set&amp;gt;
        &amp;lt; /condition&amp;gt;
        &amp;lt; condition value="from"&amp;gt;
            &amp;lt; set token="s_query"&amp;gt;index=mail eventtype=pps_filter [search index=mail eventtype=pps_filter $i_criteria$!=x_mailer $i_criteria$=$s_value|s$ | stats count by internal_message_id, host | fields internal_message_id, host] | iplocation hops_ip | stats max(_time) AS _time, values(delivery_status) AS delivery_status, values(subject) AS subject, values(from) AS from, values(rcpt) AS to, values(sender_domain) AS sender_domain, values(hops_ip) AS infr_ip, values(Country) AS country, values(file_name) AS file_name, values(message_id) AS message_id, values(x_mailer) AS x_mailer  by internal_message_id, host | search delivery_status=$d_status$ | join type=outer message_id [search index=mail eventtype=mail_details | eval x_mailer=if(x_mailer="","NULL",x_mailer) | stats count by message_id,x_mailer | fields message_id, x_mailer] |table _time, delivery_status, subject, from, to, sender_domain, infr_ip, country, file_name, message_id, x_mailer | sort _time&amp;lt; /set&amp;gt;
        &amp;lt; /condition&amp;gt;
        &amp;lt; condition value="sender_domain"&amp;gt;
            &amp;lt; set token="s_query"&amp;gt;index=mail eventtype=pps_filter [search index=mail eventtype=pps_filter $i_criteria$!=x_mailer $i_criteria$=$s_value|s$ | stats count by internal_message_id, host | fields internal_message_id, host] | iplocation hops_ip | stats max(_time) AS _time, values(delivery_status) AS delivery_status, values(subject) AS subject, values(from) AS from, values(rcpt) AS to, values(sender_domain) AS sender_domain, values(hops_ip) AS infr_ip, values(Country) AS country, values(file_name) AS file_name, values(message_id) AS message_id, values(x_mailer) AS x_mailer  by internal_message_id, host | search delivery_status=$d_status$ | join type=outer message_id [search index=mail eventtype=mail_details | eval x_mailer=if(x_mailer="","NULL",x_mailer) | stats count by message_id,x_mailer | fields message_id, x_mailer] |table _time, delivery_status, subject, from, to, sender_domain, infr_ip, country, file_name, message_id, x_mailer | sort _time&amp;lt; /set&amp;gt;
        &amp;lt; /condition&amp;gt;
        &amp;lt; /change&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I then replaced my query statement with &lt;CODE&gt;&amp;lt; query&amp;gt;$s_query$&amp;lt; /query&amp;gt;&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;The query does not run.  I receive a message "Search Factory: Unknown search command 's'."  In addition, the submit button no longer functions.&lt;/P&gt;

&lt;P&gt;Any ideas?&lt;/P&gt;

&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Apr 2017 16:01:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-select-dashboard-panel-query-based-on-dropdown-input/m-p/352901#M23000</guid>
      <dc:creator>adamblock2</dc:creator>
      <dc:date>2017-04-28T16:01:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to select dashboard panel query based on dropdown input selection</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-select-dashboard-panel-query-based-on-dropdown-input/m-p/352902#M23001</link>
      <description>&lt;P&gt;@adamblock2 - Just so you know, there is special markup language on this site so certain symbols will transform your post.  If you wrap a word in &lt;CODE&gt;&amp;lt;&lt;/CODE&gt; or &lt;CODE&gt;&amp;gt;&lt;/CODE&gt;, without wrapping it in a &lt;CODE&gt;code sample&lt;/CODE&gt;, it will transform your post. If you wish to show the &lt;CODE&gt;&amp;lt; &amp;gt;&lt;/CODE&gt; (i.e. you are displaying sample code), simply click on the Code Sample icon to the right of the Blockquote icon in the formatting toolbar. &lt;/P&gt;</description>
      <pubDate>Fri, 28 Apr 2017 16:08:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-select-dashboard-panel-query-based-on-dropdown-input/m-p/352902#M23001</guid>
      <dc:creator>aaraneta_splunk</dc:creator>
      <dc:date>2017-04-28T16:08:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to select dashboard panel query based on dropdown input selection</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-select-dashboard-panel-query-based-on-dropdown-input/m-p/352903#M23002</link>
      <description>&lt;P&gt;Hm. I'll see if I can replicate the issue in my instance. It might have to do with escaping characters or formatting the search string. I'll report back. &lt;/P&gt;</description>
      <pubDate>Fri, 28 Apr 2017 17:16:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-select-dashboard-panel-query-based-on-dropdown-input/m-p/352903#M23002</guid>
      <dc:creator>frobinson_splun</dc:creator>
      <dc:date>2017-04-28T17:16:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to select dashboard panel query based on dropdown input selection</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-select-dashboard-panel-query-based-on-dropdown-input/m-p/352904#M23003</link>
      <description>&lt;P&gt;I tried setting up a similar example with test code. &lt;/P&gt;

&lt;P&gt;What worked:&lt;BR /&gt;
a dropdown whose selection is used (as a token) to conditionally set a query string in a panel. &lt;/P&gt;

&lt;P&gt;What didn't work:&lt;BR /&gt;
Combining tokenized selection or input values from a text box and a dropdown in the query. I don't think they are "aware" of input events on each other, so the query is not getting populated with tokenized values from both the dropdown and the text box. &lt;/P&gt;

&lt;P&gt;I'll tinker a bit more with my own source code to see if there's something I can suggest.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Apr 2017 18:13:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-select-dashboard-panel-query-based-on-dropdown-input/m-p/352904#M23003</guid>
      <dc:creator>frobinson_splun</dc:creator>
      <dc:date>2017-04-28T18:13:40Z</dc:date>
    </item>
  </channel>
</rss>

