Dashboards & Visualizations

Fill default option from dropdown with a token

DanielSp
Explorer

Hello,

I have a dropdown that I need to be filled depending other dropdown
Dropdown1:
A->X
B->Y,Z
C->W,Z

If I selected A in the first one, I need that appear already selected X in the second dropdown
If I selected B in the second one, I need that appear already selected (change from previous selection) to Y,Z in the second dropdown
If I selected C in the thirstone, I need that appear already selected (change from previous selection) to W,Z in the second dropdown

I tried with a token in the first dropdown and put the follow code in the second dropdown
<default>$token$</default>
It would work with only ONE value, but I not achieve that work for B and C that have 2 values

Could you please help me with It?
Thanks a lot

Labels (1)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

If I understand correctly, the second dropdown is a multi-select which you want some of the options preselected based on the choice of the first dropdown?

    <input type="dropdown" token="choice" searchWhenChanged="true">
      <label>Choice</label>
      <choice value="X">A</choice>
      <choice value="Y,Z">B</choice>
      <choice value="W,Z">C</choice>
      <change>
        <eval token="form.preselect">split($choice$,",")</eval>
      </change>
    </input>
    <input type="multiselect" token="preselect" searchWhenChanged="true">
      <label>Preselect</label>
      <choice value="W">W</choice>
      <choice value="X">X</choice>
      <choice value="Y">Y</choice>
      <choice value="Z">Z</choice>
    </input>

View solution in original post

DanielSp
Explorer

Thanks a lot¡ It works¡

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

If I understand correctly, the second dropdown is a multi-select which you want some of the options preselected based on the choice of the first dropdown?

    <input type="dropdown" token="choice" searchWhenChanged="true">
      <label>Choice</label>
      <choice value="X">A</choice>
      <choice value="Y,Z">B</choice>
      <choice value="W,Z">C</choice>
      <change>
        <eval token="form.preselect">split($choice$,",")</eval>
      </change>
    </input>
    <input type="multiselect" token="preselect" searchWhenChanged="true">
      <label>Preselect</label>
      <choice value="W">W</choice>
      <choice value="X">X</choice>
      <choice value="Y">Y</choice>
      <choice value="Z">Z</choice>
    </input>
Get Updates on the Splunk Community!

Observability | How to Think About Instrumentation Overhead (White Paper)

Novice observability practitioners are often overly obsessed with performance. They might approach ...

Cloud Platform | Get Resiliency in the Cloud Event (Register Now!)

IDC Report: Enterprises Gain Higher Efficiency and Resiliency With Migration to Cloud  Today many enterprises ...

The Great Resilience Quest: 10th Leaderboard Update

The tenth leaderboard update (11.23-12.05) for The Great Resilience Quest is out &gt;&gt; As our brave ...