Dashboards & Visualizations

Dashboard condition match - how do you escape speech marks?

VexenCrabtree
Path Finder

I've been trying a few things to the extent that I've forgotten how to do basic things (= or ==?, " or \"?)... the overall aim is to have a dashboard panel show only if any input textbox has a value. (If they're all blank, I want to hide it).

<input type="text" token="pIP" searchWhenChanged="true">
    <label>Enter IP Address</label>
        <change>
           <condition match="$pIP$==&quot;&quot; AND $pHost$==&quot;&quot;">
                <unset token="X"></unset>

But I can't get the token to unset, and I guess it's the speech marks that I'm getting wrong, so I've been trying different ways to get the condition match to work, but haven't got it right yet.

<condition match="$pIP$='' AND $pHost$=''"> <!--single-quote marks-->

or

<condition match="$pIP$=='' AND $pHost$==''">
0 Karma
1 Solution

Vijeta
Influencer

@VexenCrabtree Use this for unsetting your token in case both the inputs are blank and for setting when either is not blank.

<condition match='$field1$="" AND $field2$="" '>
   <unset token="X"></unset>
 </condition>
 <condition match=' $field1$!="" OR  $field2$!="" ' >
      <set token="X">1</set>
  </condition>

View solution in original post

Vijeta
Influencer

@VexenCrabtree Use this for unsetting your token in case both the inputs are blank and for setting when either is not blank.

<condition match='$field1$="" AND $field2$="" '>
   <unset token="X"></unset>
 </condition>
 <condition match=' $field1$!="" OR  $field2$!="" ' >
      <set token="X">1</set>
  </condition>

VexenCrabtree
Path Finder

Ha ha ha, that's it! Using single-quotes for the outside means that the =="" works, whereas ='' wasn't working.

0 Karma

DavidHourani
Super Champion

Hi @VexenCrabtree,

You can just use depends on that panel and put two tokens there as a condition. If both are set the panel show, else it doesnt :

 <panel depends="$Condition1$,$Condition2$">

No need to use condition or any additional logic here.

Cheers,
David

0 Karma

VexenCrabtree
Path Finder

I want it to show if $Condition1$ is set OR if $Condition2$ is set.

0 Karma

DavidHourani
Super Champion

In that case. Just reverse your logic like this :

<condition match=" $pIP$==&quot;*&quot;  OR $pHost$==&quot;*&quot;">
     <set token="X"></set>
0 Karma

VexenCrabtree
Path Finder

I like the idea! Logically, that's sound for that particular , however, there are other things I need to do if just one is set but not the other, and unfortunately your suggestion stops me from being able to differentiate. I'd have to build some exponentially complicated

0 Karma
Get Updates on the Splunk Community!

New This Month in Splunk Observability Cloud - Metrics Usage Analytics, Enhanced K8s ...

The latest enhancements across the Splunk Observability portfolio deliver greater flexibility, better data and ...

Alerting Best Practices: How to Create Good Detectors

At their best, detectors and the alerts they trigger notify teams when applications aren’t performing as ...

Discover Powerful New Features in Splunk Cloud Platform: Enhanced Analytics, ...

Hey Splunky people! We are excited to share the latest updates in Splunk Cloud Platform 9.3.2408. In this ...