Dashboards & Visualizations
Highlighted

Hiding multiple dashboard panels when "no results found"

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
Highlighted

Re: Hiding multiple dashboard panels when "no results found"

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
Highlighted

Re: Hiding multiple dashboard panels when "no results found"

Explorer

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

0 Karma
Highlighted

Re: Hiding multiple dashboard panels when "no results found"

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="hidetable">true</set>
<unset token="hide
table1"><unset>
</condition>
</search>
</table>
</panel>
<title>$form.Store$ Tills</title>
<table depends="$hidetable$">
<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
Highlighted

Re: Hiding multiple dashboard panels when "no results found"

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
Highlighted

Re: Hiding multiple dashboard panels when "no results found"

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
Highlighted

Re: Hiding multiple dashboard panels when "no results found"

Esteemed Legend

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

0 Karma