Dashboards & Visualizations

How to dynamically populate multiselect based on dropdown in my dashboard?

gbwilson
Path Finder

I have two inputs on my dashboard, the first is a dropdown input and the second is a multiselect. The first dropdown shows a list of asset types (host, vm, pc, etc.) and the second multiselect input is a list of operating systems. When somebody clicks on on an asset type, I'd like the multiselect to populate with only operating systems for that device type.

<form>
  <label>CMS_OS_TEST2</label>
  <fieldset submitButton="false">
    <input type="dropdown" token="sourcetype" searchWhenChanged="true">
      <label>Asset Type</label>
      <choice value="*">ALL</choice>
      <prefix>sourcetype="</prefix>
      <suffix>"</suffix>
      <fieldForLabel>sourcetype</fieldForLabel>
      <fieldForValue>sourcetype</fieldForValue>
      <search>
        <query>(index=cms_vm OR index=cms_host OR index=cms_pc) 
| eval sourcetype=case(sourcetype == "cms_vm", "VM", sourcetype == "cms_host", "Host", sourcetype == "cms_pc", "PC")
| table sourcetype
| dedup sourcetype</query>
        <earliest>0</earliest>
        <latest></latest>
      </search>
    </input>
    <input type="multiselect" token="osfield" searchWhenChanged="true">
      <label>Operating System</label>
      <fieldForLabel>OperatingSystem_Code</fieldForLabel>
      <fieldForValue>OperatingSystem_Code</fieldForValue>
      <search>
        <query>(index="cms_pc" OR index="cms_vm" OR index="cms_host"
| eval sourcetype=case(sourcetype == "cms_vm", "VM", sourcetype == "cms_host", "Host", sourcetype == "cms_pc", "PC")
| eval OperatingSystem_Code=case(sourcetype == "cms_pc", OperatingSystem_Code, sourcetype == "cms_vm", OperatingSystem_Code, sourcetype == "cms_host", OperatingSystem_Code)
| dedup OperatingSystem_Code</query>
        <earliest>0</earliest>
        <latest></latest>
      </search>
      <choice value="*">ALL</choice>
      <valuePrefix>OperatingSystem_Code="</valuePrefix>
      <valueSuffix>"</valueSuffix>
      <delimiter> OR  </delimiter>
    </input>
  </fieldset>
</form>

To sum it up: when I select 'PC' for the asset type, I only want to see Operating Systems found in the PC index, so on and so forth.

0 Karma
1 Solution

brendanmatthews
Explorer

You can add sourcetype=$sourcetype$ in the query for your multiselect search, which will use the first token to search for the second.

View solution in original post

brendanmatthews
Explorer

You can add sourcetype=$sourcetype$ in the query for your multiselect search, which will use the first token to search for the second.

gbwilson
Path Finder

Thanks for your help. Working well now.

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas     Cisco Live 2026 is almost here, and this ...

What Is the Name of the USB Key Inserted by Bob Smith? (BOTS Hint, Not the Answer)

Hello Splunkers,   So you searched, “what is the name of the usb key inserted by bob smith?”  Not gonna lie… ...

Automating Threat Operations and Threat Hunting with Recorded Future

    Automating Threat Operations and Threat Hunting with Recorded Future June 29, 2026 | Register   Is your ...