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!

Detecting Remote Code Executions With the Splunk Threat Research Team

REGISTER NOWRemote code execution (RCE) vulnerabilities pose a significant risk to organizations. If ...

Observability | Use Synthetic Monitoring for Website Metadata Verification

If you are on Splunk Observability Cloud, you may already have Synthetic Monitoringin your observability ...

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...