Dashboards & Visualizations

Dropdown visibility

Jasmine
Path Finder

i have three drop down lists. one with component(A,B,C,D). other dropdown with severity(Info,Warning) and colour dropdown list.

If i select A,Info - colour dropdownlsit should be shown
if i select B,Info - colour dropdownlist should not be shown.


how can i achieve this?

Labels (1)
0 Karma

bowesmana
SplunkTrust
SplunkTrust

It's actually easy enough with a bit of inline CSS - see this simple XML dashboard example, which hides the colour dropdown and sets the colour to black. If you select A, C or D then the colour dropdown is re-shown.

<form version="1.1" theme="light">
  <label>ddl</label>
  <fieldset submitButton="false">
    <input type="dropdown" token="component" searchWhenChanged="true">
      <label>Component</label>
      <choice value="A">A</choice>
      <choice value="B">B</choice>
      <choice value="C">C</choice>
      <choice value="D">D</choice>
      <change>
        <eval token="display_colour">if($component$="B", "display:none", "")</eval>
        <eval token="colour_name">if($component$="B", "No Colour", $colour_name$)</eval>
        <eval token="form.colour">if($component$="B", "#000000", $form.colour$)</eval>
        <eval token="colour">if($component$="B", "#000000", $colour$)</eval>
      </change>
    </input>
    <input type="dropdown" token="severity" searchWhenChanged="true">
      <label>Severity</label>
      <choice value="Info">Info</choice>
      <choice value="Warning">Warning</choice>
    </input>
    <input id="colour_dropdown" type="dropdown" token="colour" searchWhenChanged="true">
      <label>Colour Dropdown</label>
      <choice value="#000000">Black</choice>
      <choice value="#ff0000">Red</choice>
      <choice value="#00ff00">Green</choice>
      <choice value="#0000ff">Blue</choice>
      <change>
        <set token="colour_name">$label$</set>
      </change>
    </input>
  </fieldset>
  <row depends="$AlwaysHideCSS$">
    <panel>
      <html>
        <style>
          #colour_dropdown {
            $display_colour$
          }
        </style>
      </html>
    </panel>
  </row>
  <row>
    <panel>
      <html>
        <h1 style="color:$colour$">Component $component$, Severity Level $severity$, Colour $colour_name$</h1>        
      </html>
    </panel>
  </row>
</form>

 

0 Karma

PickleRick
SplunkTrust
SplunkTrust

1. Please provide more meaningful subject than "ddl" for your post next time. It greatly improves readability of the whole forum and helps visibility of your issue.

2. As far as I remember there are no built-in mechanisms to control visibility of single input either in simplexml or in DS (btw, you didn't specify what type of dashboard you're building). With simplexml you can try to use custom JS to manipulate CSS to make components (in)visible.

0 Karma

moorte
Explorer

It sounds like the user should be making choices from the first two dropdowns and that supplies the fields that will be provided in the third dropdown.  

what you want to do this is to tokenize the first two dropdowns so that the answer from them is (use better token names)
$optionA$  for the first dropdown
$optionB$ for the second dropdown

Then in the third dropdown, fill the list from a query and use the tokens in the query so something like this

index=yourindex sourceytpe=yoursourcetype valuex=$optionA$ valuey=$optionB$

Or if it is a lookup file

| inputlookup yourlookupfile | search valuex=$optionA$ valuey=$optionB$

Hope that helps.  

LAME-Creations
Explorer

Do this ^^^^^^^

0 Karma

tej57
Contributor

Hello @Jasmine,

Is this resolved?

0 Karma
Get Updates on the Splunk Community!

AppDynamics Summer Webinars

This summer, our mighty AppDynamics team is cooking up some delicious content on YouTube Live to satiate your ...

SOCin’ it to you at Splunk University

Splunk University is expanding its instructor-led learning portfolio with dedicated Security tracks at .conf25 ...

Credit Card Data Protection & PCI Compliance with Splunk Edge Processor

Organizations handling credit card transactions know that PCI DSS compliance is both critical and complex. The ...