Dashboards & Visualizations

How to hide a dashboard panel when there are no results displayed?

smuppava
Explorer

I would like to hide the panel of the dashboard when there are no results displayed. When I incorporate the piece of code from Splunk Answers into my dashboard, the entire panel is hidden although when there are results displayed. I ONLY want my panel to be hidden when there are absolutely no results displayed. Please provide your inputs.

Thx for your help,
Sirisha M

1 Solution

skoelpin
SplunkTrust
SplunkTrust

This is untested but should work

<panel depends="$hide_panel$">
       <chart>
         <search>
           <query>sourcetype=*</query>
           <progress>
             <condition match="'job.resultCount' == 0">
               <unset token="hide_panel"></unset>
             </condition>
             <condition>
               <set token="hide_panel">true</set>
             </condition>
           </progress>
         </search>
       </chart>
     </panel>

View solution in original post

skoelpin
SplunkTrust
SplunkTrust

This is untested but should work

<panel depends="$hide_panel$">
       <chart>
         <search>
           <query>sourcetype=*</query>
           <progress>
             <condition match="'job.resultCount' == 0">
               <unset token="hide_panel"></unset>
             </condition>
             <condition>
               <set token="hide_panel">true</set>
             </condition>
           </progress>
         </search>
       </chart>
     </panel>

vince_iw
Explorer

works for me, thanks. should the token be named the other way around though? ie $show_panel$

0 Karma

smuppava
Explorer

Thx a bunch for your help. This worked finally for me!

0 Karma

smuppava
Explorer

Also, can you please help with the below as well?

How do I hide the panel when there are multiple columns in which time is one of them. By default time is being populated and the other columns display no data.

In this specific scenario where time, peakthreadcount, totalstartthreadcount columns are displayed within the search results, ONLY time is been populated with data and rest of the two columns display no data data at all. I would like to hide the panel ONLY when time is been populated and rest of the columns display no data.

How can this be accomplished?

Thx in advance

0 Karma

smuppava
Explorer

Also, how do I hide the panel when the search displays "no results found". Currently, the search text "no results found" is displayed on the panel. How do I hide the panel in this scenario?

0 Karma

skoelpin
SplunkTrust
SplunkTrust

Great! Can you accept this answer?

0 Karma

smuppava
Explorer

The blog given below doesn't specify the xml code although it does display the html version of it. Are you able to provide the xml code on how to hide the dashboard panels when the search results displays no results.

0 Karma

skoelpin
SplunkTrust
SplunkTrust
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

May 2026 Splunk Expert Sessions: Security & Observability

Level Up Your Operations: May 2026 Splunk Expert Sessions Whether you are refining your security posture or ...

Network to App: Observability Unlocked [May & June Series]

In today’s digital landscape, your environment is no longer confined to the data center. It spans complex ...

SPL2 Deep Dives, AppDynamics Integrations, SAML Made Simple and Much More on Splunk ...

Splunk Lantern is Splunk’s customer success center that provides practical guidance from Splunk experts on key ...