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!

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...