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">
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
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.
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.
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.
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 "hidepanel4" will only be updated if the search depends on the token value "showdiag".
If this is really needed, the cleanest option to me is still always going to be a JS extension.
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.
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.