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!

How to send events & findings from AWS to Splunk using Amazon EventBridge

Amazon EventBridge is a serverless service that uses events to connect application components together, making ...

Exciting News: The AppDynamics Community Joins Splunk!

Hello Splunkers,   I’d like to introduce myself—I’m Ryan, the former AppDynamics Community Manager, and I’m ...

The All New Performance Insights for Splunk

Splunk gives you amazing tools to analyze system data and make business-critical decisions, react to issues, ...