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!

.conf24 | Day 0

Hello Splunk Community! My name is Chris, and I'm based in Canberra, Australia's capital, and I travelled for ...

Enhance Security Visibility with Splunk Enterprise Security 7.1 through Threat ...

(view in My Videos)Struggling with alert fatigue, lack of context, and prioritization around security ...

Troubleshooting the OpenTelemetry Collector

  In this tech talk, you’ll learn how to troubleshoot the OpenTelemetry collector - from checking the ...