Hi,
I want to use condition to set a "show" OR a "hide" panel (if no result) :
<row depends="$panel_hide$">
<panel id="no_result">
<title>List</title>
<html>
<style>
#clear .dashboard-panel {background: white;}
</style>
<center>
<h2>No result<i class="icon-check icon-no-underline" style="font-size:100%;color:#65a637;"/>
</h2>
</center>
</html>
</panel>
</row>
<row depends="$panel_show$">
<panel>
<title>List</title>
<table>
<search>
<query>index=A sourcetype="B" id=*
| table id name start end
| sort - start</query>
<earliest>-10m</earliest>
<latest>now</latest>
<sampleRatio>1</sampleRatio>
<finalized>
<condition match="$job.resultCount$>0">
<set token="panel_show">true</set>
</condition>
<condition>
<set token="panel_hide"></set>
<unset token="panel_show"></unset>
</condition>
</finalized>
</search>
<option name="count">20</option>
<option name="dataOverlayMode">none</option>
<option name="drilldown">none</option>
<option name="percentagesRow">false</option>
<option name="refresh.display">progressbar</option>
<option name="rowNumbers">false</option>
<option name="totalsRow">false</option>
<option name="wrap">true</option>
</table>
</panel>
</row>
This code not working... It gives me both panel :
What it is wrong with my code ?
Thanks for help.
Add unset token for the panel_hide in the first condition
ie.
<finalized>
<condition match="$job.resultCount$>0">
<set token="panel_show">true</set>
<unset token="panel_hide"></unset>
</condition>
<condition>
<set token="panel_hide"></set>
<unset token="panel_show"></unset>
</condition>
</finalized>
That was the solution ! Thank you.
Is there a way to create a condition which says : if the table command does not return result so display a massage like "The list is empty" without a panel hide like I did ?
You may user appendpipe
e.g.
|makeresults count=1|eval data="Something"
|appendpipe [|stats count|where count=0|eval data="The list is empty" |fields - count]
Run this search and change the count value to 0 see the difference. Appreciate 👍 if the solution/replies helps