Hi at all,
in a dashboard, I need the possibility to choose between two searches to display results in a panel and at the same time to display an html message if there's no result in each of them.
In other words, I'd like to use two depends from Splunk Dashboard Examples App in a panel: a "Link Switcher" and a "Null Search Swapper".
The "Link switcher" correctly runs but I always have the html message, in other words the "Null Search Swapper" doesn't run.
This is my code:
<form>
<label>Home Page</label>
<search id="search_1">
<query>
my_search1
</query>
<earliest>$Time.earliest$</earliest>
<latest>$Time.latest$</latest>
<progress>
<condition match="$job.resultCount$ == 0">
<set token="show_html1">Errors</set>
</condition>
<condition>
<unset token="show_html1"></unset>
</condition>
</progress>
</search>
<search id="search_2">
<query>
my_search2
</query>
<earliest>$Time.earliest$</earliest>
<latest>$Time.latest$</latest>
<progress>
<condition match="$job.resultCount$ == 0">
<set token="show_html2">Errors</set>
</condition>
<condition>
<unset token="show_html2"></unset>
</condition>
</progress>
</search>
<fieldset submitButton="false">
<input type="time" token="Time">
<label>Periodo</label>
<default>
<earliest>@d</earliest>
<latest>now</latest>
</default>
</input>
</fieldset>
<row>
<panel>
<input type="link" token="application">
<label>Area Applicativa:</label>
<choice value="One">One</choice>
<choice value="Two">Two</choice>
<default>One</default>
<change>
<condition value="One">
<set token="showOne">true</set>
<unset token="showTwo"></unset>
</condition>
<condition value="Two">
<unset token="showOne"></unset>
<set token="showTwo">true</set>
</condition>
</change>
</input>
</panel>
</row>
<row>
<panel>
<table depends="$showOne$" rejects="$show_html1$">
<search base="search_1">
<query>
my_query
</query>
</search>
<option name="count">100</option>
<option name="dataOverlayMode">none</option>
<option name="drilldown">none</option>
<option name="percentagesRow">false</option>
<option name="rowNumbers">false</option>
<option name="totalsRow">false</option>
<option name="wrap">true</option>
</table>
<html depends="$show_html1$">
<p style="color:green;margin-left:30px;font-size:30px">No Errors</p>
</html>
<table depends="$showTwo$" rejects="$show_html2$">
<search base="search_2">
<query>
my_search
</query>
</search>
<option name="count">100</option>
<option name="dataOverlayMode">none</option>
<option name="drilldown">none</option>
<option name="percentagesRow">false</option>
<option name="rowNumbers">false</option>
<option name="totalsRow">false</option>
<option name="wrap">true</option>
</table>
<html depends="$show_html2$">
<p style="color:green;margin-left:30px;font-size:30px">No Errors</p>
</html>
</panel>
</row>
</form>
I don't understand if there's something wrong or if it's not possible to combine two depends.
Thank you in advance.
Bye.
Giuseppe
I'm trying to wrap my head about this, but I am not sure I get it. My best guess is that we need to separate the depends
and rejects
statements. Does it work if you replace the final <row>
element with this:
<row>
<panel depends="$showOne$">
<table rejects="$show_html1$">
<search base="search_1">
<query>
my_query
</query>
</search>
<option name="count">100</option>
<option name="dataOverlayMode">none</option>
<option name="drilldown">none</option>
<option name="percentagesRow">false</option>
<option name="rowNumbers">false</option>
<option name="totalsRow">false</option>
<option name="wrap">true</option>
</table>
<html depends="$show_html1$">
<p style="color:green;margin-left:30px;font-size:30px">No Errors</p>
</html>
</panel>
<panel depends="$showTwo$">
<table rejects="$show_html2$">
<search base="search_2">
<query>
my_search
</query>
</search>
<option name="count">100</option>
<option name="dataOverlayMode">none</option>
<option name="drilldown">none</option>
<option name="percentagesRow">false</option>
<option name="rowNumbers">false</option>
<option name="totalsRow">false</option>
<option name="wrap">true</option>
</table>
<html depends="$show_html2$">
<p style="color:green;margin-left:30px;font-size:30px">No Errors</p>
</html>
</panel>
</row>
I'm trying to wrap my head about this, but I am not sure I get it. My best guess is that we need to separate the depends
and rejects
statements. Does it work if you replace the final <row>
element with this:
<row>
<panel depends="$showOne$">
<table rejects="$show_html1$">
<search base="search_1">
<query>
my_query
</query>
</search>
<option name="count">100</option>
<option name="dataOverlayMode">none</option>
<option name="drilldown">none</option>
<option name="percentagesRow">false</option>
<option name="rowNumbers">false</option>
<option name="totalsRow">false</option>
<option name="wrap">true</option>
</table>
<html depends="$show_html1$">
<p style="color:green;margin-left:30px;font-size:30px">No Errors</p>
</html>
</panel>
<panel depends="$showTwo$">
<table rejects="$show_html2$">
<search base="search_2">
<query>
my_search
</query>
</search>
<option name="count">100</option>
<option name="dataOverlayMode">none</option>
<option name="drilldown">none</option>
<option name="percentagesRow">false</option>
<option name="rowNumbers">false</option>
<option name="totalsRow">false</option>
<option name="wrap">true</option>
</table>
<html depends="$show_html2$">
<p style="color:green;margin-left:30px;font-size:30px">No Errors</p>
</html>
</panel>
</row>
It works!
Thank you very much.
Bye.
Giuseppe
Great!! I'm glad we got it sorted.
I'm pretty confused by these two lines:
<table depends="$showOne$" rejects="$show_html1$">
<table depends="$showTwo$" rejects="$show_html2$">
What should happen if $showOne$
and $show_html1$
are both defined/set? Should it display or not? Likewise for the Two/2 line - what happens if both are defined/set?
Probably this is the problem:
I have two conditions: one guided by Link Switcher and one guided by Null Swapper.
these are the eight situations:
where:
In few words, I have problems when:
I hope to be clear, the problem is to manage two switchers at the same time!
Bye.
Giuseppe
I have used below syntax so a panel will stay hidden until 2 or more conditions have been met. Hopefully helps.
<panel depends="$isLinux$$isHealthy$">
That panel only shows when both tokens have a <set> value. If any token is <unset> then that panel is hidden.