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!

Enterprise Security Content Update (ESCU) | New Releases

In January, the Splunk Threat Research Team had one release of new security content via the Splunk ES Content ...

Expert Tips from Splunk Professional Services, Ensuring Compliance, and More New ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Observability Release Update: AI Assistant, AppD + Observability Cloud Integrations & ...

This month’s releases across the Splunk Observability portfolio deliver earlier detection and faster ...