Dashboards & Visualizations

How to hide one panel and keep other intact based on conditions and vice versa?

ASISH_9
Engager

Hello,

I have three panels , first one is account level second one the whole month's data and third one till date's data starting from first day of the give month (Month filter is a drop down).There is a checkbox which when checked will hide the second panel (which contain whole month's data ) and display the third panel (till date's data).When unchecked the third one gets hidden and the second one is displayed.

By default first one will be displayed whether the box is checked or unchecked.
Please suggest a XML code for this.

Tags (1)
0 Karma

somesoni2
SplunkTrust
SplunkTrust

You basically have to define tokens based on your condition (may be in form inputs or a search element) and then use that token's existence in depends attribute of panels to show/hide them. A quick google search of 'splunk show hide dashboard panels' gives these reference posts:

https://answers.splunk.com/answers/519099/how-to-hideshow-panel-in-the-dashboard-based-on-ra.html
https://answers.splunk.com/answers/218623/how-to-hide-panels-with-no-results-from-a-dashboar.html
https://answers.splunk.com/answers/188709/how-to-display-dashboard-panels-dynamically.html

0 Karma

niketn
Legend

@ASISH_9, based on your query seems like you want to toggle between panel 2 and panel 3 while your panel 1 is always displayed. Although your issue description is a bit unclear, as far as you need toggle functionality following run anywhere search should work. Please also refer to Splunk 6.x Dashboard Examples App for Link Switcher Example:

  <fieldset submitButton="false">
    <input type="checkbox" token="showPanel">
      <label></label>
      <choice value="togglePanel">Check to See Panel 3/ Uncheck for Panel 2</choice>
      <change>
        <condition value="togglePanel">
          <set token="showPanel2">Panel 2 is set</set>
          <unset token="showPanel3"></unset>
        </condition>
        <condition>
          <set token="showPanel3">Panel 3 is set</set>
          <unset token="showPanel2"></unset>
        </condition>        
      </change>
    </input>
  </fieldset>
  <row>
    <panel>
      <table>
        <title>Panel 1</title>
        <search>
          <query>| makeresults
| eval Panel="Panel1"
| table Panel</query>
          <earliest>-24h@h</earliest>
          <latest>now</latest>
          <sampleRatio>1</sampleRatio>
        </search>
        <option name="count">20</option>
        <option name="dataOverlayMode">none</option>
        <option name="drilldown">none</option>
        <option name="percentagesRow">false</option>
        <option name="rowNumbers">false</option>
        <option name="totalsRow">false</option>
        <option name="wrap">true</option>
      </table>
    </panel>
  </row>
  <row>
    <panel depends="$showPanel2$">
      <table>
        <title>Panel 2 token($showPanel2$, $showPanel3$)</title>
        <search>
          <query>| makeresults
| eval Panel="Panel2"
| table Panel</query>
          <earliest>-24h@h</earliest>
          <latest>now</latest>
          <sampleRatio>1</sampleRatio>
        </search>
        <option name="count">20</option>
        <option name="dataOverlayMode">none</option>
        <option name="drilldown">none</option>
        <option name="percentagesRow">false</option>
        <option name="rowNumbers">false</option>
        <option name="totalsRow">false</option>
        <option name="wrap">true</option>
      </table>
    </panel>
    <panel depends="$showPanel3$">
      <table>
        <title>Panel 3 token($showPanel2$,$showPanel3$)</title>
        <search>
          <query>| makeresults
| eval Panel="Panel3"
| table Panel</query>
          <earliest>-24h@h</earliest>
          <latest>now</latest>
          <sampleRatio>1</sampleRatio>
        </search>
        <option name="count">20</option>
        <option name="dataOverlayMode">none</option>
        <option name="drilldown">none</option>
        <option name="percentagesRow">false</option>
        <option name="rowNumbers">false</option>
        <option name="totalsRow">false</option>
        <option name="wrap">true</option>
      </table>
    </panel>
  </row>

Another option for you would be to use single token but add depends to panel2 and rejects to panel3

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

niketn
Legend

@ASISH_9, were you able to try the suggested option?

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

ASISH_9
Engager

Actually i still couldn't get it.
Your xml uses tokens for panels but my panel already uses token.Let me give you the specifics:

My dashboard consist of 2 drop downs(one for domain and other is for time period) and 1 checkbox on the header.
In the panel level there are 3 panels the first panel is an account label panel which uses the domain token for the overall time period to give the desired result.No dependency on Time period token since it gives the result for a year.
The second panel uses the time period token to generate result according to time period (like for 6 months period or for a quarter).
The third panel should display result from the starting of the current month till the last working day of the current month(like the current month is July ,so the display will be from 1st of July till 10th of July ).And this third panel will only come to play if the checkbox id chosen and this should override the second panel.

BTW Thanks for the taking out time and answering my concern .Although your solution is ideal but my requirement is'nt covered.
I would be obliged if you can devise some other alternative.

0 Karma

rjthibod
Champion

What is the desired effect you are looking for? I am unclear on what you want to happen.

If possible, sharing your XML would be helpful. Sharing the checkbox definition would be a good minimum.

0 Karma
Get Updates on the Splunk Community!

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...