Dashboards & Visualizations

Dynamic dropdown field options using another dropdown value

ISP8055
Path Finder

Hi there, 
Is there a way to create/display a dynamic dropdown using value selected from another dropdown?

For example of what I'm trying to do: 
Suppose I have 2 fields: Region and Server Name.

 

Region  Server

NY           A1

                 B1
                 X1

                 Z1

LA            A2

                 Y2

                  Z2

TO          A3

                B3

                 C3

 

So, the first drop-down gives the user option of selecting region : TO, NY or LA. 
User selects the region: NY,

then it should display a dropdown listing the name of NY's server names

and when the user selects a NY server: B1, then it displays the panel based on search for server: S1 

Labels (1)
Tags (2)
0 Karma
1 Solution

manjunathmeti
SplunkTrust
SplunkTrust

hi @ISP8055,

Yes, you can use the first dropdown token in the second dropdown to filter results. Check this.

<fieldset submitButton="true" autoRun="false">
    <input type="dropdown" token="sourcetype">
      <label>Sourcetype</label>
      <fieldForLabel>sourcetype</fieldForLabel>
      <fieldForValue>sourcetype</fieldForValue>
      <search>
        <query>index=_internal | stats count by sourcetype</query>
        <earliest>-60m@m</earliest>
        <latest>now</latest>
      </search>
    </input>
    <input type="dropdown" token="host">
      <label>Hosts</label>
      <fieldForLabel>host</fieldForLabel>
      <fieldForValue>host</fieldForValue>
      <search>
        <query>index=_internal sourcetype="$sourcetype$" | stats count by host</query>
        <earliest>-24h@h</earliest>
        <latest>now</latest>
      </search>
    </input>
  </fieldset>

 

If this reply helps you, an upvote/like would be appreciated.

View solution in original post

manjunathmeti
SplunkTrust
SplunkTrust

hi @ISP8055,

Yes, you can use the first dropdown token in the second dropdown to filter results. Check this.

<fieldset submitButton="true" autoRun="false">
    <input type="dropdown" token="sourcetype">
      <label>Sourcetype</label>
      <fieldForLabel>sourcetype</fieldForLabel>
      <fieldForValue>sourcetype</fieldForValue>
      <search>
        <query>index=_internal | stats count by sourcetype</query>
        <earliest>-60m@m</earliest>
        <latest>now</latest>
      </search>
    </input>
    <input type="dropdown" token="host">
      <label>Hosts</label>
      <fieldForLabel>host</fieldForLabel>
      <fieldForValue>host</fieldForValue>
      <search>
        <query>index=_internal sourcetype="$sourcetype$" | stats count by host</query>
        <earliest>-24h@h</earliest>
        <latest>now</latest>
      </search>
    </input>
  </fieldset>

 

If this reply helps you, an upvote/like would be appreciated.

ISP8055
Path Finder

Hi there,

I tried your search syntax. However, when I select a option from the first dropdown list, the second dropdown doesn't let me select. Second dropdown is greyed out.

0 Karma

ISP8055
Path Finder

Hi, 

I did further troubleshooting and  found the issue with my search query. Your syntax helped.
Thanks.

0 Karma
Get Updates on the Splunk Community!

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...

Let’s Get You Certified – Vegas-Style at .conf24

Are you ready to level up your Splunk game? Then, let’s get you certified live at .conf24 – our annual user ...