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!

Splunk Decoded: Service Maps vs Service Analyzer Tree View vs Flow Maps

It’s Monday morning, and your phone is buzzing with alert escalations – your customer-facing portal is running ...

What’s New in Splunk Observability – September 2025

What's NewWe are excited to announce the latest enhancements to Splunk Observability, designed to help ITOps ...

Fun with Regular Expression - multiples of nine

Fun with Regular Expression - multiples of nineThis challenge was first posted on Slack #regex channel ...