Dashboards & Visualizations

How to have dropdown menus appear?

RylanBodrigueC
Engager
 

Hi everyone,

My goal here is as follows: based on which option the user chooses from the first dropdown menu,  a corresponding dropdown menu will appear. And the panels & graphics below will have queries based on the value passed from the second dropdown.

In other words, if I choose the TI40 from the first dropdown menu, then only the dropdown associated with it - the one that has 'depends=$show_ti40$"' - should appear. And a value chosen from the latter will influence the panels and graphics.

But this isn't really working. When I choose TI40, the dropdown menu for it does not appear. It only works as expected for ZV60 works.

What am I doing wrong? Or is there a better way to do it?

Screen Shot 2023-02-17 at 1.57.22 PM.png

Labels (3)
0 Karma

bowesmana
SplunkTrust
SplunkTrust

Look at this with the <change> element

<form>
  <label>VarDD</label>
  <fieldset submitButton="false">
    <input type="dropdown" token="appCode">
      <label>Choose appcode</label>
      <choice value="ti40">TI40</choice>
      <choice value="zv60">ZV60</choice>
      <choice value="mqp0">MQP0</choice>
      <default>ti40</default>
      <change>
        <eval token="show_ti40">if($value$="ti40", "true", null())</eval>
        <eval token="show_zv60">if($value$="zv60", "true", null())</eval>
        <eval token="show_mqp0">if($value$="mqp0", "true", null())</eval>
      </change>
    </input>
  </fieldset>
  <row>
    <panel depends="$show_ti40$">
      <html>
        ti40 IS ON
      </html>
    </panel>
    <panel depends="$show_zv60$">
      <html>
        zv60=ON
      </html>
    </panel>
    <panel depends="$show_mqp0$">
      <html>
        mqp0=ON
      </html>
    </panel>
  </row>
</form>

 

RylanBodrigueC
Engager

Hi,

I see, so that's how it would work with panels. In a similar way, how could if I make subsequent dropdown menus appear based on input from the first dropdown menu?

Thanks

0 Karma

bowesmana
SplunkTrust
SplunkTrust

depends="$token$" syntax can be used on many elements, row/panel/input/search, so just set/clear tokens as necessary in your set/eval token setter statements to show hide the elements you want - you can be as dynamic as you like.

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @RylanBodrigueC,

for my knowledge, you can use the depends on option only for panels not for inputs.

But you can pass the token from the first input to the second one.

Please, next time, share you code in the "Code Sample" panel, not as screenshot because it is un'useful.

Ciao.

Giuseppe

Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...

Step into “Hunt the Insider: An Splunk ES Premier Mystery” to catch a cybercriminal ...

After a whole week of being on call, you fell asleep on your keyboard, and you hit a sequence of buttons that ...