Dashboards & Visualizations

How to hide the panel in a dashboard based on drop down filter ?

patra966
Explorer

Let's assume 1st drop down values are 1.workplace , 2. Sales , 3. Marketing and 4 . Production.
2nd drop down values depend upon the locations.
Case -1 :If I select
India - show only Sales & Marketing
USA - show only Production
Argentina - show only workplace

Case 2: Same way I have 4 panel with some query.
If I select workplace, it should show Workplace panel with hiding all other panel.

Case3: Location as India and 2nd drop down as a sales . It should only Sales panel.

How can I get this, please help me out.

Thanks in Advance.

Tags (2)
0 Karma

DalJeanis
SplunkTrust
SplunkTrust

There are many ways to accomplish this, and the best will depend on what effect your are trying to achieve.

The general answer is - put either a "depends" or a "rejects" on each panel, and set or unset the desired tokens based on the selection in each dropdown.

This is a run-anywhere screen that will show you how to do this process.

<form>
  <label>Admin dropdown test</label>

        <search id="basechoices">
          <query>
      | makeresults
      | eval mydata="India|Sales!!!!India|Marketing!!!!Argentina|Workplace!!!!USA|Production"
      | table mydata
      | makemv delim="!!!!" mydata
      | mvexpand mydata
      | makemv delim="|" mydata
      | eval location=mvindex(mydata,0)
      | eval TheChoice=mvindex(mydata,1)
      | table location TheChoice
          </query>
          <earliest>-5m</earliest>
          <latest>now</latest>
        </search>

 <fieldset submitButton="false">

    <input type="dropdown" token="tok_location">
      <label>location</label>
      <choice value="Argentina">Argentina</choice>
      <choice value="India">India</choice>
      <choice value="USA">USA</choice>
      <change>
        <unset token="form.tok_department"></unset>
        <unset token="showSales"></unset>
        <unset token="showMarketing"></unset>
        <unset token="showProduction"></unset>
        <unset token="showWorkplace"></unset>
      </change>
       <selectFirstChoice>false</selectFirstChoice>
    </input>

    <input type="dropdown" token="tok_department">
      <label>department</label>
      <search base="basechoices">
        <query>
        | where location= "$tok_location$"
        | fields - location </query>
      </search>
      <fieldForLabel>TheChoice</fieldForLabel>
      <fieldForValue>TheChoice</fieldForValue>
      <selectFirstChoice>true</selectFirstChoice>
      <change>
        <condition match="$value$= &quot;Sales&quot; ">
        <set token="showSales"></set>
        <unset token="showMarketing"></unset>
        <unset token="showProduction"></unset>
        <unset token="showWorkplace"></unset>
        </condition>
        <condition match="$value$= &quot;Marketing&quot; ">
        <unset token="showSales"></unset>
        <set token="showMarketing"></set>
        <unset token="showProduction"></unset>
        <unset token="showWorkplace"></unset>
        </condition>
        <condition match="$value$= &quot;Production&quot; ">
        <unset token="showSales"></unset>
        <unset token="showMarketing"></unset>
        <set token="showProduction"></set>
        <unset token="showWorkplace"></unset>
        </condition>
        <condition match="$value$= &quot;Workplace&quot; ">
        <unset token="showSales"></unset>
        <unset token="showMarketing"></unset>
        <unset token="showProduction"></unset>
        <set token="showWorkplace"></set>
        </condition>
      </change>
    </input>
  </fieldset>
  <row>
    <panel depends="$showProduction$">
      <html>
        <p> PRODUCTION PANEL</p>
         </html>
    </panel>
    <panel depends="$showMarketing$">
      <html>
        <p> MARKETING PANEL</p>
         </html>
    </panel>
    <panel depends="$showWorkplace$">
      <html>
        <p> WORKPLACE PANEL</p>
         </html>
    </panel>
    <panel depends="$showSales$">
      <html>
        <p> SALES PANEL</p>
         </html>
    </panel>
  </row>
</form> 
0 Karma

to4kawa
Ultra Champion
0 Karma
Did you miss .conf21 Virtual?

Good news! The event's keynotes and many of its breakout sessions are now available online, and still totally FREE!