Dashboards & Visualizations

Hiding multiple dashboard panels when "no results found"

jackreeves
Explorer

How do you hide dashboard panel when search results=0 but you have multiple dashboard panels you want to use this function for.

Currently having an issue when I add this code to .xml it hides both panels if only one of them displays results =0. Do I need to add a search ID or Panel ID to differentiate between the two panels. See below example

<panel>
  <title>$form.Store$</title>
  <table depends="$hide.table$">
    <search>
      <query>| my search</query>
      <earliest>-4h@m</earliest>
      <latest>now</latest>
             <done>
      <condition match="'job.resultCount' == 0">
        <set token="hide_table">true</set>
      </condition>
     <condition>
  <unset token="hide_table"></unset>
    </done>
    </search>
  </table>
</panel>
  <title>$form.Store$ Tills</title>
  <table depends="$hide.table$">
    <title>Please investigate</title>
    <search>
      <query>| my search</query>
      <earliest>-7d@d</earliest>
      <latest>-0d@d</latest>
      <sampleRatio>1</sampleRatio>
      <done>
      <condition match="'job.resultCount' == 0">
        <set token="hide_table">true</set>
      </condition>
     <condition>
  <unset token="hide_table"></unset>
    </done>  
    </search>
  </table>
</panel>

Many thanks.

0 Karma
1 Solution

woodcock
Esteemed Legend

I always just keep the panels and add this to the SPL:

| appendpipe [stats count | where count=0]

View solution in original post

0 Karma

woodcock
Esteemed Legend

I always just keep the panels and add this to the SPL:

| appendpipe [stats count | where count=0]
0 Karma

adale25
Engager

What do you mean by the above code? I'm not sure I understand why or where I would use this to solve the problem of hiding dashboard panels with no results found.

0 Karma

woodcock
Esteemed Legend

This solution does not hide the panel but it hides the "no results found" message.

0 Karma

sbbadri
Motivator

<earliest>-4h@m</earliest>
<latest>now</latest>
<progress>
tonumber('job.resultCount')
</progress>
<condition match="'job.resultCount' == 0">
<set token="hide_table">true</set>
</condition>

I have see extra <condition> above unset token

0 Karma

jackreeves
Explorer

but that still hides both panels even if only one panel is displaying results = 0

0 Karma

sbbadri
Motivator

<panel>
<title>$form.Store$</title>
<table depends="$hide.table$">
<search>
<query>| my search</query>
<earliest>-4h@m</earliest>
<latest>now</latest>

<progress>
<set token="job.resultCount">tonumber('job.resultCount')</set>
</progress>
<condition match="'job.resultCount' == 0">
<set token="hide_table">true</set>
<unset token="hide_table1"><unset>
</condition>
</search>
</table>
</panel>
<title>$form.Store$ Tills</title>
<table depends="$hide_table$">
<title>Please investigate</title>
<search>
<query>| my search</query>
<earliest>-7d@d</earliest>
<latest>-0d@d</latest>
<sampleRatio>1</sampleRatio>
<progress>
<set token="job.resultCount">tonumber('job.resultCount')</set>
</progress>
<condition match="'job.resultCount' == 0">
<set token="hide_table1">true</set>
<unset token="hide_table"></unset>
</condition>
</search>
</table>
</panel>

0 Karma
Get Updates on the Splunk Community!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...