Dashboards & Visualizations

What is the XML syntax to hide panels with two depends attributes?

bosch_softtec
Path Finder

Hi all,

I'm running Splunk 6.5.0 and trying to set up a dashboard with 2 checkboxes. The 1st one is to activate/deactivate panels in general, and the 2nd one is to choose dedicated panels.

The checkboxes are set up like this:

    <input type="checkbox" token="show_token" searchWhenChanged="true">
    <label>SHOW PANELS:</label>
    <choice value="true">On</choice>
    <delimiter> </delimiter>
  </input>
  <input type="checkbox" token="show_panel" searchWhenChanged="true" depends="$show_token$">
    <label>show_diag</label>
    <choice value="1">Panel 1</choice>
    <choice value="2">Panel 2</choice>
    <delimiter> </delimiter>
    <default>1,2</default>
  </input>

If add the following option to the panel, I get an error message:

<panel depends="$show_token$", "$show_diag1">

Error message:

Invalid attribute name

The second Problem is that I have no idea how to set up the depends attribute with the different values (Panel 1 and Panel 2).

Has someone an idea how to solve this and what the depends syntax for the 2 panels should look like, In the documentation, should the dependent tokens be separated by a comma?

Thanks in advanced

Best regards
Thorsten

woodcock
Esteemed Legend

According to docs:
https://docs.splunk.com/Documentation/Splunk/latest/Viz/PanelreferenceforSimplifiedXML

depends Comma-separated list    All tokens in the list must be defined for the input to render. These tokens might be used in an input or drilldown context in the form.
rejects Comma-separated list    Prevent input rendering if one or more tokens in this list are defined. These tokens might be used in an input or drilldown context in the form.

bosch_softtec
Path Finder

After careful consideration, I rejected the idea to hide panels by more than 1 dependency. The reason is that the board becomes too complex for "normal" users which can't differ if there is choosen a wrong timespan or if the dashboard has general problems.

0 Karma

woodcock
Esteemed Legend

You should still come back here and click Accept on the best answer to close the question.

bosch_softtec
Path Finder

Hi rjthibod,

the first part is fixed. Did you know which logic is behind "depends", is it AND or OR or...?

For the second part, I was thinking about something like:

   <input type="checkbox" token="show_panel" searchWhenChanged="true" depends="$show_token$">
     <label>show_diag</label>
     <choice value="Panel_A">Panel 1</choice>
     <choice value="Panel_B">Panel 2</choice>
     <delimiter> </delimiter>
    </input>

    <panel depends="$show_token$,$hide_panel4$">
      <chart>
          <progress>
            <condition match="'$show_diag$' != *Panel_B*">
              <unset token="hide_panel4"></unset>
            </condition>
            <condition>
              <set token="hide_panel4">true</set>
            </condition>
       <search>
          <query> ....

I use something similar, to hide Panels which have no querrie output.

effem2
Path Finder

According to the Docs-Link provided by woodcock,

depends is an "AND" logic where as rejects is an "OR" logic.

0 Karma

rjthibod
Champion

The depends logic is always AND. There is no option/setting that will give you OR logic.

Regarding the logic proposal, I think that will only partly work. The <progress> item will only update when the search runs, so your token value for "hide_panel4" will only be updated if the search depends on the token value "show_diag".

If this is really needed, the cleanest option to me is still always going to be a JS extension.

0 Karma

rjthibod
Champion

Fixing your first error should be easy. Change the depends to the following (where there is only one set of double quotes in the depends segment.

<panel depends="$show_token$,$show_panel$">

Now, the hard part is your request to define unique tokens for each checkbox. That is not supported in SimpleXML without trying to do some really weird things. If you are willing to use JS extensions, it can be easily done.

Here is a link to a similar question I asked a while ago that basically wanted to do the same thing.

https://answers.splunk.com/answers/221926/how-to-set-tokens-for-checkboxes-using-simple-xml.html

Get Updates on the Splunk Community!

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...

Let’s Get You Certified – Vegas-Style at .conf24

Are you ready to level up your Splunk game? Then, let’s get you certified live at .conf24 – our annual user ...