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):
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="["a,b"]"
When setting the xml to use <set token="tok_multi">a" , "b</set> DOM is
data-test-values="["a\" , \"b"]" 🙂 (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>
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 ! 🎉
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 ! 🎉
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!)