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!

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

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...