Splunk Enterprise

How to unset Splunk cascading dropdown tokens in a proper way?

deepikagooty
Explorer

I have a dashboard with cascading dropdowns which when a value selected in first dropdown populates the second dropdown with values based on the selection made.

For example the first dropdown has values A, B, and C. When A is selected from the first dropdown, the second dropdown should display A1, A2, and A3. Similarly should display B1, B2, B3 and C1, C2, C3 respectively.

My dashboard is populating the dropdown correctly. I am unsetting the second dropdown tokens when the first dropdown changes, to make sure the second dropdown do not contain previous token value. But this is causing me an issue while page reload. When the page is refreshed, the second dropdown token gets unset like shown below.

Before refresh

deepikagooty_2-1652375071594.png

After refresh

deepikagooty_3-1652375093349.png

If I do not unset the second dropdown tokens when the first dropdown changes, the second drop down shows the previous selected token as shown below.

deepikagooty_4-1652375131073.png

My xml looks like this

 

<form>
  <label>Dependent Drilldown</label>
  <fieldset submitButton="false">
    <input type="dropdown" token="tokElement" searchWhenChanged="true">
      <label>Element</label>
      <choice value="A">A</choice>
      <choice value="B">B</choice>
      <choice value="C">C</choice>
      <change>
        <unset token="tokSubElement"></unset>
        <unset token="form.tokSubElement"></unset>
      </change>
    </input>
    <input type="dropdown" token="tokSubElement" searchWhenChanged="true">
      <label>Sub Element</label>
      <fieldForLabel>$tokElement$</fieldForLabel>
      <fieldForValue>$tokElement$</fieldForValue>
      <search>
        <query>| makeresults
| fields - _time
| eval A="A1,A2,A3",B="B1,B2,B3",C="C1,C2,C3" 
| fields $tokElement$
| makemv $tokElement$ delim=","
| mvexpand $tokElement$</query>
      </search>
    </input>
  </fieldset>
</form>

 

I would like my second dropdown tokens to be unset when first dropdown value changes and also maintain those tokens on page refresh. Let me know if you have any thoughts.

Labels (2)
0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Introducing Splunk 10.0: Smarter, Faster, and More Powerful Than Ever

Now On Demand Whether you're managing complex deployments or looking to future-proof your data ...

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...