Splunk Enterprise

How do you hide a panel based on a drop-down selection? (Static Options)

UMDTERPS
Communicator

Hi!

I have a drop-down menu that has 3 static options, "Server," "Non-Server," and "All."  

 How do I hide a panel if a user selects "Server" or "Non-Server"?  

Labels (2)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

Seems like a misleading error message because you appear to have a *missing* close tag.

    <change>
        <condition label="All">
            <set token="show_panel">1</set>
        </condition>
        <condition label="Server">
            <unset token="show_panel"/> <-- was not closed
        </condition>
        <condition label="Non-Server">
             <unset token="show_panel"/>
        </condition>
      </change>
---
If this reply helps you, Karma would be appreciated.

View solution in original post

richgalloway
SplunkTrust
SplunkTrust

Set a token based on the selected drop-down item and make your panel dependent on that token.  See this example stolen from https://docs.splunk.com/Documentation/Splunk/8.0.4/Viz/tokens#Conditional_operations_with_form_input...

<form>
  <label>Just an example</label>
  <fieldset submitButton="false">
    <input type="radio" token="server_tok">
      <label>Select a time range</label>
      <choice value="server">Server</choice>
      <choice value="nonserver">Non-Server</choice>
      <choice value="all">All</choice>
      <default>All</default>

      <change>
        <condition label="Server">
          <set token="show_panel">1</set>
        </condition>
        <condition label="Non-Server">
          <set token="show_panel">1</set>
        </condition>
        <condition label="All">
          <unset token="show_panel"/>
        </condition>
      </change>
    </input>
  </fieldset>
  <row>
    <panel depends=$show_panel$>
...

 

---
If this reply helps you, Karma would be appreciated.
0 Karma

UMDTERPS
Communicator

Where does the below XML go in the panel I want to hide? Is the below XML all I need?

 <panel depends=$show_panel$>


For example, this is sample panel code I have of a panel I want to hide, where does the XML go in the XML to hide the panel?

</>OMG, posting is so much different now with the new format. </>

0 Karma

richgalloway
SplunkTrust
SplunkTrust

I thought it was apparent.

<panel depends=$show_panel$>
<title>Servers and Computers</title>
<single>
<search>
<query>|inputlookup data.csv
| search snum = "$system$"
|search rack="$sys$"
| table systrem os rack
| dedup ip
</query>
<earliest>-60m@m</earliest>
<latest>now</latest>
</search>
<option name="drilldown">none</option>
<option name="refresh.display">progressbar</option>
</single>
</panel>
---
If this reply helps you, Karma would be appreciated.
0 Karma

UMDTERPS
Communicator

Ahh, I see, it has to in the actual panel header. However, the set and unset tagging does the opposite of I want it to do. The panel does not appear when a user selects "All."  I changed the XML to the following, but its giving me an error, "Unexpected close tag"

    <change>
        <condition label="All">
            <set token="show_panel">1</set>
        </condition>
        <condition label="Server">
            <unset token="show_panel">
        </condition>
        <condition label="Non-Server">
             <unset token="show_panel"/>
        </condition>
      </change>

 

 





0 Karma

richgalloway
SplunkTrust
SplunkTrust

Seems like a misleading error message because you appear to have a *missing* close tag.

    <change>
        <condition label="All">
            <set token="show_panel">1</set>
        </condition>
        <condition label="Server">
            <unset token="show_panel"/> <-- was not closed
        </condition>
        <condition label="Non-Server">
             <unset token="show_panel"/>
        </condition>
      </change>
---
If this reply helps you, Karma would be appreciated.

UMDTERPS
Communicator

BOOM! Worked! Thanks! 😃

0 Karma

gstultz_splunk
Splunk Employee
Splunk Employee

If you're familiar with token setting, you can set/unset to view/not view a panel.  Search for this "How can I show/hide panels dynamically with tokens?" posted by "thiagoded" for more details.

0 Karma

gstultz_splunk
Splunk Employee
Splunk Employee

Sorry for a typo..it was posted by "thiagodede".

0 Karma
Get Updates on the Splunk Community!

Enterprise Security Content Update (ESCU) | New Releases

In December, the Splunk Threat Research Team had 1 release of new security content via the Enterprise Security ...

Why am I not seeing the finding in Splunk Enterprise Security Analyst Queue?

(This is the first of a series of 2 blogs). Splunk Enterprise Security is a fantastic tool that offers robust ...

Index This | What are the 12 Days of Splunk-mas?

December 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...