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

vnravikumar
Champion

Hi

Change <progress> to <done> and try

0 Karma

akarivaratharaj
Communicator

Thankyou.. its working 🙂

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...

Step into “Hunt the Insider: An Splunk ES Premier Mystery” to catch a cybercriminal ...

After a whole week of being on call, you fell asleep on your keyboard, and you hit a sequence of buttons that ...