Dashboards & Visualizations

How to specify an or clause to display a panel

kikiBen12
Engager

Hi,

I have a panel in an xml dashboard and 2 dropdown inputs that are populated by a search and have a value corresponding to none which is the default value.

I want to display the panel if at least one of the input have a different value than the default.
I have made a token for each input which is set when a value different from none is selected and unset when the default value is chosen.

I have thought at the depends attribute to a panel to which I pass my 2 tokens. But the problem is that the depends attribute is performing an AND clause to the tokens given. The thing I want is an OR clause to the depends attribute or an AND clause to the rejects attribute.

Anyone as an idea to resolve this problem ?

Tags (3)
0 Karma
1 Solution

niketn
Legend

Without XML snippet it would be tough, but let me try

Assuming two dropdown as field1 and field2, you can code the following change event

For field1 dropdown

  <change>
     <condition match"$value$==&quot;none&quot; AND $field2$==&quot;none&quot;">
         <unset token="hidePanel"></unset>
     </condition>
     <condition>
         <set token="hidePanel">true</set>
     </condition>
  </change>

For field2 dropdown

  <change>
     <condition match"$value$==&quot;none&quot; AND $field1$==&quot;none&quot;">
         <unset token="hidePanel"></unset>
     </condition>
     <condition>
         <set token="hidePanel">true</set>
     </condition>
  </change>

Then use hidePanel in for the panel as depends token.

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"

View solution in original post

niketn
Legend

Without XML snippet it would be tough, but let me try

Assuming two dropdown as field1 and field2, you can code the following change event

For field1 dropdown

  <change>
     <condition match"$value$==&quot;none&quot; AND $field2$==&quot;none&quot;">
         <unset token="hidePanel"></unset>
     </condition>
     <condition>
         <set token="hidePanel">true</set>
     </condition>
  </change>

For field2 dropdown

  <change>
     <condition match"$value$==&quot;none&quot; AND $field1$==&quot;none&quot;">
         <unset token="hidePanel"></unset>
     </condition>
     <condition>
         <set token="hidePanel">true</set>
     </condition>
  </change>

Then use hidePanel in for the panel as depends token.

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"

kikiBen12
Engager

Thanks it help me so much ! I didn't think about doing think like this

0 Karma

niketn
Legend

@kikiBen12... Glad this one worked for you 🙂

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

rjthibod
Champion

It is probably easier and more efficient to get a clear answer if you can share the actual XML.

0 Karma
Get Updates on the Splunk Community!

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 ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...