Dashboards & Visualizations

How to clear the old values of a multiselect input when I change the value on another drop-down in my Simple XML dashboard?

sjain135
Engager

I would like to clear the old values of a multiselect input when I change the value on another drop-down. Actually, when I change the value in first drop-down, then the multiselect value does not clear the already selected value. It is taking the new values, but due to old selected value, the result in not coming as expected.

Does someone have any solution for this? I am using Simple XML in dashboard.

adevi
Explorer

I found out this answer helpful:

link here
[https://answers.splunk.com/answers/218751/selectfirstchoice-not-working-in-dynamic-dropdowns.html]

The above link did not explain it clearly.

In your drop-down Simple XML, unset the multiselect token. Make sure you specify "form. your-token-name" in the unset tag:

   <change>
        <unset token="form.my_id_name_multiselect"></unset>
      </change>

Full code

<form>
<fieldset submitButton="true" autoRun="false">
    <input type="dropdown" token="my_id" searchWhenChanged="false">
          <label>Network</label>
          <search>
            <query> index="someindex" | top ids </query>
            <earliest>@d</earliest>
            <latest>now</latest>
          </search>
          <choice value="*">All</choice>
          <change>
            <unset token="form.my_id_name_multiselect"></unset>
          </change>
          <default>*</default>
          <initialValue>*</initialValue>
        </input>
 <input type="multiselect" token="my_id_name_multiselect" searchWhenChanged="false">
      <label>Name</label>
      <choice value="*">All</choice>
      <search>
        <query>ndex="someindex" | where id=$my_id$ | table id_name</query>
        <earliest>@d</earliest>
        <latest>now</latest>
      </search>
      <default>*</default>
      <initialValue>*</initialValue>
      <prefix>(</prefix>
      <suffix>)</suffix>
      <valuePrefix>id_name="</valuePrefix>
      <valueSuffix>"</valueSuffix>
      <delimiter> OR </delimiter>
    </input>
</fieldset>
</form>

Hope this helps

richielynch89
Path Finder

Thank you adevi! Works perfect for me.

0 Karma
Get Updates on the Splunk Community!

What's new in Splunk Cloud Platform 9.1.2312?

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

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...

Let’s Get You Certified – Vegas-Style at .conf24

Are you ready to level up your Splunk game? Then, let’s get you certified live at .conf24 – our annual user ...