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!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...