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!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...