Dashboards & Visualizations

pass multiple values to multiselect box from radio input

alex_tc80
Explorer

Regarding the dasboard input panels
Im trying to set values into a multiselect when i select a certain radio option.
Basically i have 2 fields:
1) multiselect that can have values a and/or b
2) radio with 3 options, first set multiselect to value a, second to value b
and the third one SHOULD set it to a AND b.

I would expect when clicking the third option, the multiselect box
to show BOTH option A and B, but instead it just lists a single unknown option "a , b"
This is a screenshot may it explains better (3 clicks):
123.png


I tried multiple combinations with no success.

I've read https://docs.splunk.com/Documentation/Splunk/8.1.0/Viz/tokens#Define_tokens_for_multiselect_inputs   , didn't help 😞


I also tried with no success what was suggested in
https://community.splunk.com/t5/Dashboards-Visualizations/Multiselect-Tokens-not-passing-values/m-p/...

The problem is also related to the escaping of the data.(see old thread) 
When DOM inspecting the multiselect, i get 
data-test-values="["a","b"]"   when manually setting a +b directly in the form.

When setting the XML to use <set token>a , b</set> DOM is data-test-values="[&quot;a,b&quot;]"
When setting the xml to use <set token="tok_multi">a" , "b</set> DOM is 
data-test-values="[&quot;a\&quot; , \&quot;b&quot;]"  🙂 (notice the backslash .... )

My version is Splunk Enterprise v7.2.9.1
The test dashboard source is:

 

 

 

 

 

<form>
  <label>Check MultipleSelect</label>
  <fieldset submitButton="false">
    <input type="multiselect" token="tok_multi" searchWhenChanged="true">
      <label>Aquirers</label>
      <choice value="a">TEXT1</choice>
      <choice value="b">TEXT2</choice>
      <prefix/>
      <suffix/>
      <valuePrefix></valuePrefix>
      <valueSuffix></valueSuffix>
      <delimiter> , </delimiter>
    </input>
    <input type="radio" token="tok_radio">
      <label>RADIO</label>
      <choice value="SETA">SET A</choice>
      <choice value="SETB">SET B</choice>
      <choice value="SETAB">SET A + B</choice>
      <default>SETA</default>
      <change>
        <condition value="SETA">
          <set token="form.tok_multi">a</set>
          <set token="field1">$form.tok_multi$</set>
        </condition>
        <condition value="SETB">
          <set token="form.tok_multi">b</set>
          <set token="field1">$form.tok_multi$</set>
        </condition>
        <condition value="SETAB">
          <set token="form.tok_multi">a , b</set>
          <set token="field1">$form.tok_multi$</set>
        </condition>
      </change>
    </input>
    <input type="text" token="field1">
      <label>multi token value</label>
      <default>$tok_multi$</default>
    </input>
  </fieldset>
</form>

 

 

 

 

 

 

Labels (2)
Tags (1)
0 Karma
1 Solution

alex_tc80
Explorer

Instead of doing <set token>a , b</set> i used 

        <condition value="SETAB">
          <set token="form.tok_multi">a</set>
          <eval token="form.tok_multi">mvappend("b", $form.tok_multi$)</eval>

and it worked ! 🎉

View solution in original post

0 Karma

alex_tc80
Explorer

Instead of doing <set token>a , b</set> i used 

        <condition value="SETAB">
          <set token="form.tok_multi">a</set>
          <eval token="form.tok_multi">mvappend("b", $form.tok_multi$)</eval>

and it worked ! 🎉

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

You should mark this as solved so others can find the solution easier (and we don't waste further time looking into solving it for you!)

0 Karma
Get Updates on the Splunk Community!

Optimize Cloud Monitoring

  TECH TALKS Optimize Cloud Monitoring Tuesday, August 13, 2024  |  11:00AM–12:00PM PST   Register to ...

What's New in Splunk Cloud Platform 9.2.2403?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.2.2403! Analysts can ...

Stay Connected: Your Guide to July and August Tech Talks, Office Hours, and Webinars!

Dive into our sizzling summer lineup for July and August Community Office Hours and Tech Talks. Scroll down to ...