Dashboards & Visualizations

How to reset a child multiselect input when the value for the parent input is changed?

Path Finder

Hi

I'm having some trouble trying to reset multiselect value:
I have a first multiselect input where you can choose some Region. Then I have a second multiselect input for Country which is populated based on the value(s) chosen in the first multiselect form.

So for example when I select Asia-Pacific for Region, I then can choose Australia for Country. What I would like to do is an auto-delete of Australia in Country as soon as I deselect Asia-Pacific in SubRegion. Currently, if I deselect Asia-Pacific and select France, we have SubRegion = France and Country=Australia which is not a logical selection.

Thanks in advance for any help

[EDIT]

here is a piece of my xml:

<fieldset submitButton="false" autoRun="true">
    <input type="multiselect" token="subregion" searchWhenChanged="true">
      <label>Sub Region:</label>
      <choice value="*">All sub-regions</choice>
      <search>
        <query>index=ibo_idx_system|  table "Sub Region _CRD" | stats first(*) as * by "Sub Region _CRD"</query>
        <earliest>0</earliest>
      </search>
      <prefix>(</prefix>
      <valuePrefix>"Sub Region _CRD" ="</valuePrefix>
      <valueSuffix>"</valueSuffix>
      <delimiter> OR </delimiter>
      <suffix>)</suffix>
      <fieldForLabel>Sub Region _CRD</fieldForLabel>
      <fieldForValue>Sub Region _CRD</fieldForValue>
      <change>
        <unset token="country"></unset>
      </change>
    </input>
    <input type="multiselect" token="country" searchWhenChanged="true">
      <label>Country:</label>
      <search>
        <query>index=ibo_idx_system |search $subregion$ | table "Country _CRD" | stats first(*) as * by  "Country _CRD"</query>
        <earliest>0</earliest>
      </search>
     <prefix>(</prefix>
      <valuePrefix>"Country _CRD" ="</valuePrefix>
      <valueSuffix>"</valueSuffix>
      <delimiter> OR </delimiter>
      <suffix>)</suffix>
      <fieldForLabel>Country _CRD</fieldForLabel>
      <fieldForValue>Country _CRD</fieldForValue>
      <choice value="*">All countries</choice>
      <change>
        <unset token="subregion"></unset>
      </change>
    </input>
1 Solution

Path Finder

Hi

Working on this problem with a colleague, we finally find how we have to do:
We don't have to unset only the token "country" but also the token "form.country"

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

And then when Subregion change we don't see the Country selected input anymore.
Thank you very much sundareshr for your answer!

View solution in original post

Path Finder

Hi

Working on this problem with a colleague, we finally find how we have to do:
We don't have to unset only the token "country" but also the token "form.country"

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

And then when Subregion change we don't see the Country selected input anymore.
Thank you very much sundareshr for your answer!

View solution in original post

Path Finder

I am also facing similar kind of issue. I have a Timerange input and one more Multiselect input to select application. Whenever I refresh the page or I open it newly, still the previous value which I selected in the mutiselect is still showing.
My multiselect value is depend on the timerange which I select. Below is my sample code:

<input type="time" token="timerange" searchWhenChanged="true">
  <label>Timerange</label>
  <default>
    <earliest>-15m</earliest>
    <latest>now</latest>
  </default>
</input>
<input type="multiselect" token="app" searchWhenChanged="true">
  <label>Application</label>
  <fieldForLabel>App</fieldForLabel>
  <fieldForValue>App</fieldForValue>
  <default></default>
  <search>
    <query>index=* |table app |dedup app</query>
    <earliest>$timerange.earliest$</earliest>
    <latest>$timerange.latest$</latest>
  </search>
  <choice value="*">All</choice>
  <change>
    <unset>token="form.timerange"</unset>
  </change>
</input>

I am using the token $app$ in my further code. Could anyone please help me on this

0 Karma

Path Finder

Resolved my problem, thanks !!!

0 Karma

Legend

Have you tried unsetting the token in your SubRegion dropdown? Add this to your Country dropdown

<input token="country">
...
<change>
   <unset token="subregion"></unset>
</change>
</input>

Path Finder

Thanks for reply. I tried but doesn't work: I've tried <change><unset token="country"></unset></change> in my subregion input and alos <change><unset token="subregion"></unset></change> in my subregion input. One of them or both, nothing works. I always have the selection in my input

0 Karma