Dashboards & Visualizations

How to set multiple values for a multi-select input

AKG1_old1
Builder

Hello,
I have one multi-select input and looking to set its value dynamically based on some condition.

Not sure how to set multiple values to multi-select input token.
For example, if condition 1 satisfy it should set 3 values to multiselect input.

<search>
    <query>| makeresults  </query>
    <done>
      <condition match="CONDITION 1">
          <eval token="form.MULTISELECT_TOKEN">"VALUE_2  VALUE_3 VALUE_4"</eval>
      </condition>
       <condition match="CONDITION 2">
              <eval token="form.MULTISELECT_TOKEN">"VALUE_1"</eval>    
      </condition>
    </done>
  </search>

 <input type="multiselect" token="MULTISELECT_TOKEN">
      <label>NICKNAME</label>
      <!--choice value="*">All</choice-->
      <choice value="VALUE_1">VALUE_1</choice>
      <choice value="VALUE_2">VALUE_2</choice>
      <choice value="VALUE_3">VALUE_3</choice>
      <choice value="VALUE_4">VALUE_4</choice>
      <default>VALUE_1</default>
    </input>
0 Karma
1 Solution

VatsalJagani
SplunkTrust
SplunkTrust

Hello @agoyal,

Few XML elements you can specify with multi-select by that you can do.

<input type="multiselect" token="MULTISELECT_TOKEN">
       <label>NICKNAME</label>
       <!--choice value="*">All</choice-->
       <choice value="VALUE_1">VALUE_1</choice>
       <choice value="VALUE_2">VALUE_2</choice>
       <choice value="VALUE_3">VALUE_3</choice>
       <choice value="VALUE_4">VALUE_4</choice>
       <default> ( "VALUE_1" ) </default>
       <valuePrefix>"</valuePrefix>
       <valueSuffix>"</valueSuffix>
       <delimiter> , </delimiter>
       <prefix> ( </prefix>
       <suffix> ) </suffix>
</input>

Then you specify value like:

<set token="form.MULTISELECT_TOKEN"> ( "VALUE_2" , "VALUE_3" , "VALUE_4" ) </set>

and Splunk dashboard will automatically select these three values. You can use other prefix, sufix and delimiter like AND, OR, etc. as per your requirement.

Hope this helps!!!

View solution in original post

VatsalJagani
SplunkTrust
SplunkTrust

Hello @agoyal,

Few XML elements you can specify with multi-select by that you can do.

<input type="multiselect" token="MULTISELECT_TOKEN">
       <label>NICKNAME</label>
       <!--choice value="*">All</choice-->
       <choice value="VALUE_1">VALUE_1</choice>
       <choice value="VALUE_2">VALUE_2</choice>
       <choice value="VALUE_3">VALUE_3</choice>
       <choice value="VALUE_4">VALUE_4</choice>
       <default> ( "VALUE_1" ) </default>
       <valuePrefix>"</valuePrefix>
       <valueSuffix>"</valueSuffix>
       <delimiter> , </delimiter>
       <prefix> ( </prefix>
       <suffix> ) </suffix>
</input>

Then you specify value like:

<set token="form.MULTISELECT_TOKEN"> ( "VALUE_2" , "VALUE_3" , "VALUE_4" ) </set>

and Splunk dashboard will automatically select these three values. You can use other prefix, sufix and delimiter like AND, OR, etc. as per your requirement.

Hope this helps!!!

AKG1_old1
Builder

Thank you for answer. it's not fully working in my case may be as I can't use prefix and postfit for multiselect.

I have used this and worked for me.

<set token="form.NICKNAME_TOKEN"> Value 1" "Value2" "Value3</set>

eval is not working with this so I have to use set.

0 Karma

VatsalJagani
SplunkTrust
SplunkTrust

Very nice to hear that you figured that out. Basically all options are options which are fits with your case you can use those. Yeah we need to use set not eval, thanks for that.

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!

Index This | What travels the world but is also stuck in place?

April 2026 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Discover New Use Cases: Unlock Greater Value from Your Existing Splunk Data

Realizing the full potential of your Splunk investment requires more than just understanding current usage; it ...

Continue Your Journey: Join Session 2 of the Data Management and Federation Bootcamp ...

As data volumes continue to grow and environments become more distributed, managing and optimizing data ...