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
SplunkTrust
SplunkTrust

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
SplunkTrust
SplunkTrust

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
SplunkTrust
SplunkTrust

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!

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 ...