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!

Splunk Observability Cloud's AI Assistant in Action Series: Auditing Compliance and ...

This is the third post in the Splunk Observability Cloud’s AI Assistant in Action series that digs into how to ...

Splunk Community Badges!

  Hey everyone! Ready to earn some serious bragging rights in the community? Along with our existing badges ...

What You Read The Most: Splunk Lantern’s Most Popular Articles!

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...