Dashboards & Visualizations

How to dynamically change dropdown values based on radio button selection

vn86893
Explorer

Hello,

I am planning to display some server in the drop down based on the selection of dropdown.
From the image, I want to select all servers in test10 series when 1.0 is selected.
i.e when 1.0 is selected I need to display test10-19 in a dropdown,
when 2.0 selected I need to display test20-29 and
when 3.0 is selected I need to display test30-39 in dropdown.

alt text

0 Karma

vnravikumar
Champion

Hi

How you are populating Server dropdown?

0 Karma

vn86893
Explorer

These are static server names. Not necessarily need to be just 10 of them. There may be multiple servers. I can have a list of servers that need to populate in dropdown when a radio button is selected.

0 Karma

jpolvino
Builder

Then you need to somehow label those servers so that when the 1.0 radio button is selected, it knows which servers to populate the drop down with. One way to do it is a lookup, but this requires maintenance to stay accurate.

If this is the case, then please add this detail and I'm sure you'll get a number of solutions. The answer I posted below would still work, but lines 24-27 would need to be updated to pick rows from the lookup table and assign the field for value and label correctly.

0 Karma

jpolvino
Builder

This gets you pretty close I believe:

<form>
  <label>dynamic dropdown</label>
  <fieldset submitButton="false">
    <input type="time" token="dateTime">
      <label>Time</label>
      <default>
        <earliest>-60m@m</earliest>
        <latest>now</latest>
      </default>
    </input>
    <input type="radio" token="category">
      <label>Category</label>
      <choice value="0">1.0</choice>
      <choice value="1">2.0</choice>
      <choice value="2">3.0</choice>
      <change>
        <set token="mult">$value$</set>
        <set token="form.Server"></set>
        <set token="Server"></set>
      </change>
    </input>
    <input type="dropdown" token="Server">
      <label>Server</label>
      <fieldForLabel>Test</fieldForLabel>
      <fieldForValue>Test</fieldForValue>
      <search>
        <query>| makeresults count=10 | eval Test=1 | accum Test | eval Test=Test+9+($mult$*10) | eval Test="Test".Test</query>
        <earliest>-24h@h</earliest>
        <latest>now</latest>
      </search>
      <default></default>
      <initialValue></initialValue>
    </input>
  </fieldset>
</form>
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!

Turn Cisco Telemetry Into Action with Cisco Data Fabric, powered by the Splunk ...

The surge in machine data is already hitting enterprise budgets, and the agentic era will only intensify it. ...

Persistent Queue at TcpOut — One of Splunk's Most Practical Features

Splunk introduced persistent queueing at the tcpout layer as one of the most practical resilience features in ...

Skip the Awkward Silence: Have a .conf-ersation at .conf26

Picture this. You arrive at .conf26 already having your socializing and networking plans mapped out. No ...