Dashboards & Visualizations

Default value for dropdown with dynamic datasource in Dashboard Studio

eriktb
Observer
Hello,
 
I have a Dashboard Studio dashboard (Splunk 9.2.3) with a pair of dropdown inputs (“Environment” and “Dependent Dropdown”). The first dropdown, “Environment”, has a static list of items (“Q1", “Q2", “Q3", “Q4"). The items for the second dropdown, “Dependent Dropdown”, has a datasource which dynamically sets the items based on the token set by “Environment”. For example, when “Environment” is set to “Q2”, the items for “Dependent Dropdown” are (“DIRECT", “20", “21", “22", “23"). For each selection of “Environment”, the list of items of “Dependent Dropdown” begins with the value “DIRECT”.
 
The behavior I am trying to achieve is that when a selection is made in “Environment” that the selection in “Dependent Dropdown” be set to the first item (i.e., “DIRECT”) of the newly set item list  determined by the selection for “Environment”.
 
I have tried using the configuration user interface for “Dependent Dropdown” to set “Default selected values” to “First value”. However, when I these steps, the resulting value in “Dependent Dropdown” is “Select a value”:
 
  1. Select “Q2” for “Environment”
  2. Select “21” for “Dependent Dropdown”
  3. Select “Q1” for “Environment”
     
    The result is that “Dependent Dropdown” shows “Select a value”. I would like ”Dependent Dropdown” to show the intended default value (the first value of the item list) of “DIRECT”. 
     
    How can this be achieved?
     
    Thank you in advance for responses,
    Erik
     
    (Source of example dashboard included)
     
     
    Screenshot 2025-02-24 at 11.38.19 AM.png

 

 

{
    "visualizations": {},
    "dataSources": {
        "ds_ouyeecdW": {
            "type": "ds.search",
            "options": {
                "enableSmartSources": true,
                "query": "| makeresults\n| eval env = \"$env$\"\n| eval dependent=case(env=\"Q1\", \"DIRECT\", env=\"Q2\", \"DIRECT;20;21;22;23\", env=\"Q3\", \"DIRECT;30;31\", env=\"Q4\", \"DIRECT;40;41;42;43;44\")\n| makemv dependent delim=\";\"\n| mvexpand dependent\n| table dependent"
            },
            "name": "Search_Dependent_Dropdown"
        }
    },
    "defaults": {
        "dataSources": {
            "ds.search": {
                "options": {
                    "queryParameters": {
                        "latest": "$global_time.latest$",
                        "earliest": "$global_time.earliest$"
                    }
                }
            }
        }
    },
    "inputs": {
        "input_ZIhOcc3q": {
            "options": {
                "items": [
                    {
                        "label": "Q1",
                        "value": "Q1"
                    },
                    {
                        "label": "Q2",
                        "value": "Q2"
                    },
                    {
                        "label": "Q3",
                        "value": "Q3"
                    },
                    {
                        "label": "Q4",
                        "value": "Q4"
                    }
                ],
                "token": "env",
                "selectFirstSearchResult": true
            },
            "title": "Environment",
            "type": "input.dropdown"
        },
        "input_1gjNEk0A": {
            "options": {
                "items": [],
                "token": "dependent",
                "selectFirstSearchResult": true
            },
            "title": "Dependent Dropdown",
            "type": "input.dropdown",
            "dataSources": {
                "primary": "ds_ouyeecdW"
            }
        },
        "input_Ih820ou2": {
            "options": {
                "defaultValue": "-24h@h,now",
                "token": "global_time"
            },
            "title": "Time Range Input Title",
            "type": "input.timerange"
        }
    },
    "layout": {
        "type": "grid",
        "structure": [],
        "globalInputs": [
            "input_Ih820ou2",
            "input_ZIhOcc3q",
            "input_1gjNEk0A"
        ]
    },
    "description": "",
    "title": "Dependent Dropdown Example"
}

 

 

Labels (1)
Tags (1)
0 Karma
Get Updates on the Splunk Community!

Fueling your curiosity with new Splunk ILT and eLearning courses

At Splunk Education, we’re driven by curiosity—both ours and yours! That’s why we’re committed to delivering ...

Splunk AI Assistant for SPL 1.1.0 | Now Personalized to Your Environment for Greater ...

Splunk AI Assistant for SPL has transformed how users interact with Splunk, making it easier than ever to ...

Unleash Unified Security and Observability with Splunk Cloud Platform

     Now Available on Microsoft AzureOn Demand Now Step boldly into the AI revolution with enhanced security ...