Dashboards & Visualizations

Dashboard condition match value

pinksqtuason
Explorer

Hi all ,
This is my situation , i have 2 inputs (textbox 1) and (textbox 2) and 3 panel (panel1,panel2,panel3)
what i want to do is :
If there is a value in textbox 1 (show) panel1, (hide) panel2
If there is a value in textbox 2 (show) panel 2, (hide) panel1
If there are value on both textbox 1 and textbox 2 (show) panel 3, (hide) panel1 and panel2

Thanks in advance.

Tags (1)
0 Karma

rlalwani_splunk
Splunk Employee
Splunk Employee

Considering the issue with the third panel, you can use javascript. Use the on change event of the textbox to set and unset tokens
For e.g

var defaultTokenModel = mvc.Components.getInstance('default', {create: true});
var submittedTokenModel = mvc.Components.getInstance('submitted', {create: true});

var textbox1 = mvc.Components.get("textbox1_id");
var textbox2 = mvc.Components.get("textbox2_id");

textbox1.on("change", function(event)
{
    textbox1_value = event
    textbox2_value = submittedTokenModel.get("textbox2");
    if(textbox1_value!="" && textbox1_value!="")
    {
        submittedTokenModel.set("Show_Panel_3","true");
        defaultTokenModel.set("Show_Panel_3","true");
    }
});

Similarly on change event of textbox2 check for values in both the textbox and set the token to Show Panel3 and unset the tokens of Panel1 and Panel2 to unhide the tokens.

0 Karma

niketn
Legend

@rlalwani , similar to your input1 change event handler, input2 change event handler would also need to be coded in JavaScript.

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

rlalwani_splunk
Splunk Employee
Splunk Employee

Yeah that's what I have mentioned in the last sentence.

0 Karma

rlalwani_splunk
Splunk Employee
Splunk Employee

You can use tokens here.
For e.g

<input type="text" token="token_name" id="token_id">
      <label>Value</label>
      <default></default>
</input>

And in the panel, you add depends attribute like below:

<panel depends="$token_name$">
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 ...