Dashboards & Visualizations

Why my condition token not working ?

mah
Builder

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$&gt;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 : 

mah_0-1609068634116.png

 

What it is wrong with my code ?

Thanks for help.

Labels (1)
Tags (1)
0 Karma

renjith_nair
Legend

Add unset token for the panel_hide in the first condition

ie.

<finalized>
 <condition match="$job.resultCount$&gt;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>

 

---
What goes around comes around. If it helps, hit it with Karma 🙂
0 Karma

mah
Builder

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 ?

 

0 Karma

renjith_nair
Legend

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

 

---
What goes around comes around. If it helps, hit it with Karma 🙂
0 Karma
Get Updates on the Splunk Community!

New in Observability - Improvements to Custom Metrics SLOs, Log Observer Connect & ...

The latest enhancements to the Splunk observability portfolio deliver improved SLO management accuracy, better ...

Improve Data Pipelines Using Splunk Data Management

  Register Now   This Tech Talk will explore the pipeline management offerings Edge Processor and Ingest ...

3-2-1 Go! How Fast Can You Debug Microservices with Observability Cloud?

Register Join this Tech Talk to learn how unique features like Service Centric Views, Tag Spotlight, and ...