Dashboards & Visualizations
Highlighted

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

Path Finder

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
Highlighted

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

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

Highlighted

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

Path Finder

@vnravikumar Wow!! Its working...!! Thankyou for the quick response

0 Karma
Highlighted

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

Path Finder

Hi @vnravikumar,

I am facing one more problem with the above code. If I provide the shorter time duration like 15 minutes, 1 hour, 4 hours, my query is running faster, fetching the results and showing Panel1 & Panel2 . If there are no results, it is giving me the Panel3.

But, whenever we give larger time duration (which fetches more logs/events) like 24 hours, 3 days, 1 week, etc., my query is taking sometime to execute and show the results. In between this query search/execute time, my panel3 is getting displayed. Once the query execution is over and it gives me result, my panel3 disappears and panel1 & panel2 is getting displayed.

That should not happen. Basically my panel1 & panel2 is executing its query, nothing should be displayed on the dashboard. Once the query completes its execution it should display either case1 or case2.

Could you please help me on this?

0 Karma
Highlighted

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

Champion

Hi

Change <progress> to <done> and try

0 Karma
Highlighted

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

Path Finder

Thankyou.. its working 🙂

0 Karma
Highlighted

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

Path Finder

@vnravikumar I have one more problem.
I have a multiselect input (token is App_Value). So whenever I click all option (all=*), only then my panel1 should display. For any other inputs, my panel1 should be hidden.
Currently I am trying like this but not working

<done>
<condition $App_Value$="*">
<set token="hide_panel">true</set>
</condition>
<condition>
<unset token="hide_panel"></unset>
</condition>
</done>

Can you please help me

0 Karma
Highlighted

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

Champion

HI, this is for the different requirement or for the same one.

0 Karma
Highlighted

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

Champion

can you please reiterate the requirement once.

0 Karma
Highlighted

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

Path Finder

This is for the same dashboard. Earlier I had three panels, now I have added two more.
Panel1 & Panel2—> Shows overall results only when the input selected as All. Which is token App_Value =*
Panel3 & Panel4 -> have some query and fetch me some result.
Panel5 —> just have custom text which displays whenever the Panel1, Panel2, Panel3 & Panel4 do not have any results.

I have tried the below conditions to hide the panels accordingly
<condition match="$App_Value$ == *">
<condition $App_Value$="*">

But both of these are not working. Panel 1 & Panel 2 are displaying whenever Panel 3 & Panel4 also are displaying.
Could you please help me.

0 Karma