Dashboards & Visualizations

How to hide panels, based on other panel's result?

akarivaratharaj
Communicator

I have three panels in my dashboard.
Panel1 & Panel2 —> have some query and fetch me some result.
Panel3 —> just have custom text which displays whenever the Panel1 & Panel2 do not have any results.

Requirements:
1. Hide Panel1 & Panel2 when job result is 0. Show the Panel 3
2. Hide Panel 3 when job result is !=0. Show the Panel & Panel2

I have used the below code to hide the Panel1 & Panel2 when there are no results

<progress>
            <condition match="$job.resultCount$ == 0">
              <unset token="hide_panel2"></unset>
            </condition>
            <condition>
              <set token="hide_panel2">true</set>
            </condition>
          </progress>

There is no issue with this. Its working fine.

But my Panel3 has to be hidden whenever the Panel1 & Panel2 are visible. As like above code, I have tried the similar set of code to hide Panel3 based on Panel1 & Panel2 values

<progress>
            <condition match="$result.Usage_Count$ != 0">
              <unset token="hide_panel3"></unset>
            </condition>
            <condition>
              <set token="hide_panel3">true</set>
            </condition>
          </progress>

But still the panel3 is visible in all kind of conditions. I am not knowing where I am making the mistake. Could anyone please help me.

Labels (3)
0 Karma
1 Solution

vnravikumar
Champion

Hi

Try this

<dashboard>
  <label>panel</label>
  <row>

    <panel rejects="$hide_panel$">
      <table>
        <title>Panel1</title>
        <search>
          <query>index="_internal" |stats count by host </query>
          <earliest>-24h@h</earliest>
          <latest>now</latest>
          <progress>
            <condition match="$job.resultCount$ == 0">
              <set token="hide_panel">true</set>
            </condition>
            <condition>
               <unset token="hide_panel"></unset>

            </condition>
          </progress>
        </search>
        <option name="drilldown">none</option>
      </table>
    </panel>
    <panel rejects="$hide_panel$">
      <table>
        <title>Panel2</title>
        <search>
          <query>index="_internal" |stats count by host  |stats count by host </query>
          <earliest>-24h@h</earliest>
          <latest>now</latest>
          <progress>
             <condition match="$job.resultCount$ == 0">
              <set token="hide_panel">true</set>
            </condition>
            <condition>
               <unset token="hide_panel"></unset>

            </condition>
          </progress>
        </search>
        <option name="drilldown">none</option>
      </table>
    </panel>
  </row>
  <row>
    <panel depends="$hide_panel$">
      <table>
        <title>Panel3</title>
        <search>
          <query>index="_internal" |stats count by host</query>
          <earliest>-24h@h</earliest>
          <latest>now</latest>
        </search>
        <option name="drilldown">none</option>
      </table>
    </panel>
  </row>
</dashboard>

View solution in original post

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 ...