Dashboards & Visualizations

How do I hide panel when "no results found" after selecting from drop-down list?

Neel88
Explorer

Hello,

I have multiple panels in same page. When I select any criteria from the dropdown, then I want to see only the panels which have the values. 

Labels (6)
0 Karma

scelikok
SplunkTrust
SplunkTrust

Hi @Neel88,

You can use below sample. You need to set different dependency token in each panel.

<dashboard>
  <label>test_hide</label>
  <row>
    <panel depends="$panel1$">
      <title>Panel 1</title>
      <event>
        <search>
          <query>index=_internal </query>
          <earliest>-5m@m</earliest>
          <latest>now</latest>
          <progress>
            <condition match="$job.resultCount$ == 0">
              <unset token="panel1"></unset>
            </condition>
            <condition>
              <set token="panel1">true</set>
            </condition>
          </progress>
        </search>
        <option name="list.drilldown">none</option>
      </event>
    </panel>
    <panel depends="$panel2$">
      <title>Panel 2</title>
      <event>
        <search>
          <query>index=_internal nothing to found </query>
          <earliest>-5m@m</earliest>
          <latest>now</latest>
          <progress>
            <condition match="$job.resultCount$ == 0">
              <unset token="panel2"></unset>
            </condition>
            <condition>
              <set token="panel2">true</set>
            </condition>
          </progress>
        </search>
        <option name="list.drilldown">none</option>
      </event>
    </panel>
  </row>
</dashboard>

 

If this reply helps you an upvote and "Accept as Solution" is appreciated.

gemrose
Explorer

I am looking for this logic in a timechart.
Will this logic work for timechart count ?

|timechart count span=1d partial=false

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
  <row rejects="$hide_panel$">
    <panel>
      <table>
        <search>
          <done>
            <condition match="'job.resultCount' == 0">
              <set token="hide_panel">true</set>
            </condition>
            <condition>
              <unset token="hide_panel"></unset>
            </condition>
          </done>
          <query>| makeresults 
| timechart count span=1d partial=f</query>
          <earliest>0</earliest>
          <latest>now</latest>
        </search>
        <option name="drilldown">none</option>
        <option name="refresh.display">progressbar</option>
      </table>
    </panel>
  </row>
0 Karma

Neel88
Explorer

Its working perfectly. Thank you so much for your help.

0 Karma
Get Updates on the Splunk Community!

Index This | Why did the turkey cross the road?

November 2025 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  &#x1f680; Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Feel the Splunk Love: Real Stories from Real Customers

Hello Splunk Community,    What’s the best part of hearing how our customers use Splunk? Easy: the positive ...