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!

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI! Discover how Splunk’s agentic AI ...

[Puzzles] Solve, Learn, Repeat: Dereferencing XML to Fixed-length events

This challenge was first posted on Slack #puzzles channelFor a previous puzzle, I needed a set of fixed-length ...

Stay Connected: Your Guide to December Tech Talks, Office Hours, and Webinars!

What are Community Office Hours? Community Office Hours is an interactive 60-minute Zoom series where ...