<?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: If it is possible to have query/panel with conditional alternative queries/panels? in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Is-it-possible-to-have-query-panel-with-conditional-alternative/m-p/617562#M50717</link>
    <description>&lt;P&gt;Hello and I need some help on simple xml and dashboards&lt;/P&gt;&lt;P&gt;I have a token "hide_panel"&lt;/P&gt;&lt;P&gt;I have two panels - one gets an "Off" (panel1) result in the search, the other panel (panel2) gets an "On" result in the search.&lt;/P&gt;&lt;P&gt;I want to show the "On" panel when the dashboard opens, and if a search is run on panel1 - that has ";Off" in the result, hide panel2.&lt;/P&gt;&lt;P&gt;I am not understanding the tags: &amp;lt;progress&amp;gt; I do have a sample that works using a dropdown - but have yet&lt;/P&gt;&lt;P&gt;to understand how to set and unset the token so panel2 shows first, and then hides&lt;/P&gt;&lt;P&gt;My code is like this:&lt;/P&gt;&lt;P&gt;&amp;lt;search&amp;gt;&lt;BR /&gt;&amp;lt;query&amp;gt;sourcetype=linux_secure user=* eventtype="ssh_open" OR eventtype="ssh_close" | eval Date=strftime(_time, "%Y-%m-%d %H:%M:%S")&lt;BR /&gt;| eval UserAction=case(eventtype="ssh_open","On",eventtype="ssh_close","Off",1==1,UserAction)&lt;BR /&gt;| stats last(UserAction) by Date,host,user | sort - Date&lt;BR /&gt;| where 'last(UserAction)' == "Off"&amp;lt;/query&amp;gt;&lt;BR /&gt;&amp;lt;earliest&amp;gt;-35m@m&amp;lt;/earliest&amp;gt;&lt;BR /&gt;&amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;&lt;BR /&gt;&amp;lt;progress&amp;gt;&lt;BR /&gt;&amp;lt;condition match="'job.UserAction' == Off"&amp;gt;&lt;BR /&gt;&amp;lt;!-- unset token="hide_panel"&amp;gt;&amp;lt;/unset --&amp;gt;&lt;BR /&gt;&amp;lt;/condition&amp;gt;&lt;BR /&gt;&amp;lt;condition match="'job.UserAction' == Off"&amp;gt;&lt;BR /&gt;&amp;lt;set token="hide_panel"&amp;gt;false&amp;lt;/set &amp;gt;&lt;BR /&gt;&amp;lt;/condition&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;/progress&amp;gt;&lt;BR /&gt;&lt;BR /&gt;&amp;lt;sampleRatio&amp;gt;1&amp;lt;/sampleRatio&amp;gt;&lt;BR /&gt;&amp;lt;/search&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any suggestions will help,&lt;/P&gt;&lt;P&gt;thanks,&lt;/P&gt;&lt;P&gt;eholz1&lt;/P&gt;</description>
    <pubDate>Tue, 18 Oct 2022 16:44:48 GMT</pubDate>
    <dc:creator>eholz1</dc:creator>
    <dc:date>2022-10-18T16:44:48Z</dc:date>
    <item>
      <title>Is it possible to have query/panel with conditional alternative queries/panels?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Is-it-possible-to-have-query-panel-with-conditional-alternative/m-p/582950#M47760</link>
      <description>&lt;DIV class=""&gt;As follows&lt;BR /&gt;if &amp;lt;condition-based-on-token-value&amp;gt; then query_1 else query_2where query_1 and query_2 may be a series of statements producing different sets&amp;nbsp;of data.&lt;/DIV&gt;
&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class=""&gt;Given a search query can be embedded in a panel, it might achieve the equivalent results, if there were a way to have conditional panel selection:&lt;BR /&gt;if &amp;lt;condition-based-on-token-value&amp;gt; then panel_with_query_1 else panel_with_query_2&lt;BR /&gt;(The above idea is inspired by&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;A href="https://splunk-usergroups.slack.com/team/U06FK286B" target="_blank" rel="noopener noreferrer"&gt;@mmccul&lt;/A&gt;&lt;/SPAN&gt;)&lt;BR /&gt;but I don't know if it's possible to have such panel selection mechanism with Simple XML of Splunk?Or alternatively, if I could control the visibility of a panel based token value, then I might also achieve the panel selection mechanism:&lt;/DIV&gt;
&lt;UL class=""&gt;
&lt;LI&gt;define two panels with visibility control by the token value&lt;/LI&gt;
&lt;LI&gt;the controls are mutually exclusive, so that only one panel will be shown&lt;/LI&gt;
&lt;/UL&gt;
&lt;DIV class=""&gt;I'd appreciate some pointers or examples.&lt;SPAN class=""&gt;&amp;nbsp;(edited)&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Tue, 18 Oct 2022 17:17:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Is-it-possible-to-have-query-panel-with-conditional-alternative/m-p/582950#M47760</guid>
      <dc:creator>yshen</dc:creator>
      <dc:date>2022-10-18T17:17:18Z</dc:date>
    </item>
    <item>
      <title>Re: If it is possible to have query/panel with conditional alternative queries/panels?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Is-it-possible-to-have-query-panel-with-conditional-alternative/m-p/582968#M47762</link>
      <description>&lt;P&gt;You should be able to use the depends option on a panel to control whether it is visible or not.&amp;nbsp; The depends option says the panel is visible if the specified token is defined.&amp;nbsp; Using conditions to set an un-set tokens will show/hide the panels.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;panel depends="someToken"&amp;gt;
  &amp;lt;search&amp;gt;
    ...
  &amp;lt;/search&amp;gt;
&amp;lt;/panel&amp;gt;&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 28 Jan 2022 18:36:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Is-it-possible-to-have-query-panel-with-conditional-alternative/m-p/582968#M47762</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2022-01-28T18:36:55Z</dc:date>
    </item>
    <item>
      <title>Re: If it is possible to have query/panel with conditional alternative queries/panels?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Is-it-possible-to-have-query-panel-with-conditional-alternative/m-p/582994#M47765</link>
      <description>&lt;P&gt;Thanks for the solution!&lt;/P&gt;&lt;P&gt;Here is a minimum working example:&lt;/P&gt;&lt;P&gt;&amp;lt;form&amp;gt;&lt;BR /&gt;&amp;lt;label&amp;gt;Select between Current and Forecast Weather&amp;lt;/label&amp;gt;&lt;BR /&gt;&amp;lt;fieldset submitButton="false"&amp;gt;&lt;BR /&gt;&amp;lt;input type="radio" id="forecast" token="forecastToken" searchWhenChanged="true"&amp;gt;&lt;BR /&gt;&amp;lt;label&amp;gt;&amp;lt;/label&amp;gt;&lt;BR /&gt;&amp;lt;choice value="0"&amp;gt;Current&amp;lt;/choice&amp;gt;&lt;BR /&gt;&amp;lt;choice value="1"&amp;gt;Forecast&amp;lt;/choice&amp;gt;&lt;BR /&gt;&amp;lt;default&amp;gt;0&amp;lt;/default&amp;gt;&lt;BR /&gt;&amp;lt;change&amp;gt;&lt;BR /&gt;&amp;lt;condition value="0"&amp;gt;&lt;BR /&gt;&amp;lt;set token="showCurrent"&amp;gt;1&amp;lt;/set&amp;gt;&lt;BR /&gt;&amp;lt;unset token="showForecast"&amp;gt;&amp;lt;/unset&amp;gt;&lt;BR /&gt;&amp;lt;/condition&amp;gt;&lt;BR /&gt;&amp;lt;condition value="1"&amp;gt;&lt;BR /&gt;&amp;lt;set token="showForecast"&amp;gt;1&amp;lt;/set&amp;gt;&lt;BR /&gt;&amp;lt;unset token="showCurrent"&amp;gt;&amp;lt;/unset&amp;gt;&lt;BR /&gt;&amp;lt;/condition&amp;gt;&lt;BR /&gt;&amp;lt;/change&amp;gt;&lt;BR /&gt;&amp;lt;initialValue&amp;gt;0&amp;lt;/initialValue&amp;gt;&lt;BR /&gt;&amp;lt;/input&amp;gt;&lt;BR /&gt;&amp;lt;/fieldset&amp;gt;&lt;BR /&gt;&amp;lt;row&amp;gt;&lt;BR /&gt;&amp;lt;panel depends="$showCurrent$"&amp;gt;&lt;BR /&gt;&amp;lt;single&amp;gt;&lt;BR /&gt;&amp;lt;title&amp;gt;Weather&amp;lt;/title&amp;gt;&lt;BR /&gt;&amp;lt;search depends="$showCurrent$"&amp;gt;&lt;BR /&gt;&amp;lt;query&amp;gt;| makeresults&lt;BR /&gt;| eval weather="Current"&amp;lt;/query&amp;gt;&lt;BR /&gt;&amp;lt;earliest&amp;gt;-7d@h&amp;lt;/earliest&amp;gt;&lt;BR /&gt;&amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;&lt;BR /&gt;&amp;lt;/search&amp;gt;&lt;BR /&gt;&amp;lt;option name="drilldown"&amp;gt;none&amp;lt;/option&amp;gt;&lt;BR /&gt;&amp;lt;/single&amp;gt;&lt;BR /&gt;&amp;lt;/panel&amp;gt;&lt;BR /&gt;&amp;lt;panel depends="$showForecast$"&amp;gt;&lt;BR /&gt;&amp;lt;single&amp;gt;&lt;BR /&gt;&amp;lt;title&amp;gt;Weather&amp;lt;/title&amp;gt;&lt;BR /&gt;&amp;lt;search depends="$showForecast$"&amp;gt;&lt;BR /&gt;&amp;lt;query&amp;gt;| makeresults&lt;BR /&gt;| eval weather="Forecast"&amp;lt;/query&amp;gt;&lt;BR /&gt;&amp;lt;earliest&amp;gt;-7d@h&amp;lt;/earliest&amp;gt;&lt;BR /&gt;&amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;&lt;BR /&gt;&amp;lt;/search&amp;gt;&lt;BR /&gt;&amp;lt;option name="drilldown"&amp;gt;none&amp;lt;/option&amp;gt;&lt;BR /&gt;&amp;lt;/single&amp;gt;&lt;BR /&gt;&amp;lt;/panel&amp;gt;&lt;BR /&gt;&amp;lt;/row&amp;gt;&lt;BR /&gt;&amp;lt;/form&amp;gt;&lt;/P&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Sat, 29 Jan 2022 00:17:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Is-it-possible-to-have-query-panel-with-conditional-alternative/m-p/582994#M47765</guid>
      <dc:creator>yshen</dc:creator>
      <dc:date>2022-01-29T00:17:05Z</dc:date>
    </item>
    <item>
      <title>Re: If it is possible to have query/panel with conditional alternative queries/panels?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Is-it-possible-to-have-query-panel-with-conditional-alternative/m-p/617562#M50717</link>
      <description>&lt;P&gt;Hello and I need some help on simple xml and dashboards&lt;/P&gt;&lt;P&gt;I have a token "hide_panel"&lt;/P&gt;&lt;P&gt;I have two panels - one gets an "Off" (panel1) result in the search, the other panel (panel2) gets an "On" result in the search.&lt;/P&gt;&lt;P&gt;I want to show the "On" panel when the dashboard opens, and if a search is run on panel1 - that has ";Off" in the result, hide panel2.&lt;/P&gt;&lt;P&gt;I am not understanding the tags: &amp;lt;progress&amp;gt; I do have a sample that works using a dropdown - but have yet&lt;/P&gt;&lt;P&gt;to understand how to set and unset the token so panel2 shows first, and then hides&lt;/P&gt;&lt;P&gt;My code is like this:&lt;/P&gt;&lt;P&gt;&amp;lt;search&amp;gt;&lt;BR /&gt;&amp;lt;query&amp;gt;sourcetype=linux_secure user=* eventtype="ssh_open" OR eventtype="ssh_close" | eval Date=strftime(_time, "%Y-%m-%d %H:%M:%S")&lt;BR /&gt;| eval UserAction=case(eventtype="ssh_open","On",eventtype="ssh_close","Off",1==1,UserAction)&lt;BR /&gt;| stats last(UserAction) by Date,host,user | sort - Date&lt;BR /&gt;| where 'last(UserAction)' == "Off"&amp;lt;/query&amp;gt;&lt;BR /&gt;&amp;lt;earliest&amp;gt;-35m@m&amp;lt;/earliest&amp;gt;&lt;BR /&gt;&amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;&lt;BR /&gt;&amp;lt;progress&amp;gt;&lt;BR /&gt;&amp;lt;condition match="'job.UserAction' == Off"&amp;gt;&lt;BR /&gt;&amp;lt;!-- unset token="hide_panel"&amp;gt;&amp;lt;/unset --&amp;gt;&lt;BR /&gt;&amp;lt;/condition&amp;gt;&lt;BR /&gt;&amp;lt;condition match="'job.UserAction' == Off"&amp;gt;&lt;BR /&gt;&amp;lt;set token="hide_panel"&amp;gt;false&amp;lt;/set &amp;gt;&lt;BR /&gt;&amp;lt;/condition&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;/progress&amp;gt;&lt;BR /&gt;&lt;BR /&gt;&amp;lt;sampleRatio&amp;gt;1&amp;lt;/sampleRatio&amp;gt;&lt;BR /&gt;&amp;lt;/search&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any suggestions will help,&lt;/P&gt;&lt;P&gt;thanks,&lt;/P&gt;&lt;P&gt;eholz1&lt;/P&gt;</description>
      <pubDate>Tue, 18 Oct 2022 16:44:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Is-it-possible-to-have-query-panel-with-conditional-alternative/m-p/617562#M50717</guid>
      <dc:creator>eholz1</dc:creator>
      <dc:date>2022-10-18T16:44:48Z</dc:date>
    </item>
    <item>
      <title>Re: If it is possible to have query/panel with conditional alternative queries/panels?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Is-it-possible-to-have-query-panel-with-conditional-alternative/m-p/617569#M50718</link>
      <description>&lt;P&gt;Based on the code you shared, you probably want the &amp;lt;done&amp;gt; tag.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Oct 2022 17:34:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Is-it-possible-to-have-query-panel-with-conditional-alternative/m-p/617569#M50718</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2022-10-18T17:34:36Z</dc:date>
    </item>
    <item>
      <title>Re: If it is possible to have query/panel with conditional alternative queries/panels?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Is-it-possible-to-have-query-panel-with-conditional-alternative/m-p/617570#M50719</link>
      <description>&lt;P&gt;Hello richgalloway,&lt;/P&gt;&lt;P&gt;Thanks are not enough for the help provided by this forum and your replies, I will try the "done" tag.&lt;/P&gt;&lt;P&gt;thanks again,&lt;/P&gt;&lt;P&gt;eholz1&lt;/P&gt;</description>
      <pubDate>Tue, 18 Oct 2022 17:42:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Is-it-possible-to-have-query-panel-with-conditional-alternative/m-p/617570#M50719</guid>
      <dc:creator>eholz1</dc:creator>
      <dc:date>2022-10-18T17:42:26Z</dc:date>
    </item>
  </channel>
</rss>

