Dashboards & Visualizations

How to populate drop-downs with static fields based on the value chosen from the previous drop-down?

alan20854
Path Finder

Hi,

I have three drop-downs for my dashboard, and I already have a list of all the potential values for each of the three drop-downs. However, I would like the second and third drop-downs to only contain a set of the values based on the value chosen from the previous drop-down.

What is the best way to do this?

Thanks

Tags (2)
0 Karma
1 Solution

somesoni2
Revered Legend

What I would do is to create a lookup table file using these mappings and then use that lookup table to query and filter.

Create lookup table - http://docs.splunk.com/Documentation/Splunk/6.4.1/Knowledge/ConfigureCSVlookups
Say with Name dropdown_values.csv with following field/data

field1,field2,field3
PCL,EIR,PRCS_EIR
PCL,EIR,RTRV_EIR
PE,PE_WS,CREAT_NRLMT
PE,PE_WS,UPDT_DEMOGRAPHIC
...and so on

Write your dashboard's dropdowns like this

<input type="dropdown" token="token1">
   <label>Field 1</label>  
   <search>
     <query> | inputlookup dropdown_values.csv | stats count by field1 | table field1 </query>
   </search>
   <fieldForLabel>field1 </fieldForLabel>
   <fieldForValue>field1 </fieldForValue>
</input>
<input type="dropdown" token="token2">
   <label>Field 1</label>  
   <search>
     <query> | inputlookup dropdown_values.csv | search field1="$token1$" | stats count by field2 | table field2 </query>
   </search>
   <fieldForLabel>field2</fieldForLabel>
   <fieldForValue>field2</fieldForValue>
</input>
<input type="dropdown" token="token3">
   <label>Field 1</label>  
   <search>
     <query> | inputlookup dropdown_values.csv | search field1="$token1$" | stats count by field3 | table field3 </query>
   </search>
   <fieldForLabel>field3</fieldForLabel>
   <fieldForValue>field3</fieldForValue>
</input

View solution in original post

somesoni2
Revered Legend

What I would do is to create a lookup table file using these mappings and then use that lookup table to query and filter.

Create lookup table - http://docs.splunk.com/Documentation/Splunk/6.4.1/Knowledge/ConfigureCSVlookups
Say with Name dropdown_values.csv with following field/data

field1,field2,field3
PCL,EIR,PRCS_EIR
PCL,EIR,RTRV_EIR
PE,PE_WS,CREAT_NRLMT
PE,PE_WS,UPDT_DEMOGRAPHIC
...and so on

Write your dashboard's dropdowns like this

<input type="dropdown" token="token1">
   <label>Field 1</label>  
   <search>
     <query> | inputlookup dropdown_values.csv | stats count by field1 | table field1 </query>
   </search>
   <fieldForLabel>field1 </fieldForLabel>
   <fieldForValue>field1 </fieldForValue>
</input>
<input type="dropdown" token="token2">
   <label>Field 1</label>  
   <search>
     <query> | inputlookup dropdown_values.csv | search field1="$token1$" | stats count by field2 | table field2 </query>
   </search>
   <fieldForLabel>field2</fieldForLabel>
   <fieldForValue>field2</fieldForValue>
</input>
<input type="dropdown" token="token3">
   <label>Field 1</label>  
   <search>
     <query> | inputlookup dropdown_values.csv | search field1="$token1$" | stats count by field3 | table field3 </query>
   </search>
   <fieldForLabel>field3</fieldForLabel>
   <fieldForValue>field3</fieldForValue>
</input

alan20854
Path Finder

Hi somesoni1, below is a sample of the values for my dropdowns and their mappings.

PCL
.....-EIR
...............-PRCS_EIR
...............-RTRV_EIR
PE
.....-PE_WS
...............-CREAT_NRLMT
...............-UPDT_DEMOGRAPHIC
...............-XTND_NRLMT_WNDW
...............-WTHDR_NRLMT_WNDW
...............-UPDT_SPCL_ACMDN
...............-GET_APNTT
...............-CNFRM_APNTT
...............-GET_TEST_RSLT
...............-CNFRM_TEST_RSLT
...............-ATHRN
...............-GET_UTEST_RSLT
...............-CNFRM_UTEST_RSLT
PM
.....-PM_NRLMT_MSG
...............-CREAT_NRLMTS
...............-UPDT_NRLMTS_PYMNT

PV
.....-PV_APNTT
...............-CREAT_APNTT
...............-RSCHD_APNTT
...............-CNCL_APNTT
...............-UPDT_DEMOGRAPHIC
...............-QUERY_VLDT
.....-PV_CAND
...............-GET_NRLMT
.....-PV_NRLMT
...............-GET_NRLMT
.....-PV_RSLT
...............-SUBMIT_RSLT_PKG
.....-PV_TEST_PKG
...............-RQST_TEST_PKG

0 Karma

somesoni2
Revered Legend

To be able to dynamically load the options in 2nd and 3rd dropdown, you would have to use dynamic population method for those two dropdowns. Post the sample values for dropdowns and mapping of the dropdown values (upon selection of what values, which value should be shown).

0 Karma
Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Dynamic formatting from XML events

This challenge was first posted on Slack #puzzles channelFor a previous puzzle, I needed a set of fixed-length ...

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  &#x1f680; Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Stronger Security with Federated Search for S3, GCP SQL & Australian Threat ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...