Dashboards & Visualizations

Not able to display the panel as per the Drop-down input option

bhaskarasplunk
Explorer

Hi,

I am trying to build a Dashboard where as per the input of drop-down I have to change my panels, but not able to get that with the below code.
can someone please correct the below code so that my options get triggered and switches the panels as per the selected choices.

**

<input type="dropdown" token="showpanel" searchWhenChanged="false">
  <label>Select the options to get more details</label>
  <choice value="Top5">Top5</choice>
  <choice value="lowest">lowest</choice>
  <fieldForLabel>Showpanel</fieldForLabel>
  <fieldForValue>Showpanel</fieldForValue>
  <default></default>
  <change>
    <condition value="Top5">
      <set token="Top5">true</set>
      <unset token="lowest"></unset>
    </condition>
  </change>
  <change>
    <condition value="lowest">
      <unset token="Top5"></unset>
      <set token="lowest">true</set>
    </condition>
  </change>
  <initialValue></initialValue>
</input>

<panel depends="$Top5$">
  <title>Top 5 Indexes</title>
  <table>
    <search>
      <query>$query$ </query>
      <earliest>$myTimePickerToken.earliest$</earliest>
      <latest>$myTimePickerToken.latest$</latest>
    </search>

  </table>
</panel>


<panel depends="$Lowest$">
  <title>Index with least License usage</title>
  <table>
    <search>
      <query>$query2$</query>
      <earliest>$myTimePickerToken.earliest$</earliest>
      <latest>$myTimePickerToken.latest$</latest>
    </search>

  </table>
</panel>

**

Thanks,
Bhaskara.

0 Karma
1 Solution

vnravikumar
Champion

Hi @bhaskarasplunk

Try this and let me know

<form>
  <fieldset submitButton="false" autoRun="false">
    <input type="dropdown" token="field1">
      <label>field1</label>
      <choice value="top">Top5</choice>
      <choice value="lowest">Lowest</choice>
      <change>
        <condition value="top">
          <set token="showTop5">true</set>
          <unset token="showLowest"></unset>
        </condition>
        <condition value="lowest">
          <set token="showLowest">true</set>
          <unset token="showTop5"></unset>
        </condition>
        <condition>
          <unset token="showLowest"></unset>
          <unset token="showTop5"></unset>
        </condition>
      </change>
    </input>
  </fieldset>
  <row>
    <panel depends="$showTop5$" rejects="$showLowest$">
      <title>Top 5 Indexes</title>
      <table>
        <search>
          <query>$query$ </query>
          <earliest>$myTimePickerToken.earliest$</earliest>
          <latest>$myTimePickerToken.latest$</latest>
        </search>
      </table>
    </panel>
    <panel depends="$showLowest$" rejects="$showTop5$">
      <title>Index with least License usage</title>
      <table>
        <search>
          <query>$query2$</query>
          <earliest>$myTimePickerToken.earliest$</earliest>
          <latest>$myTimePickerToken.latest$</latest>
        </search>
      </table>
    </panel>
  </row>
</form>

View solution in original post

vasanthmss
Motivator

two changes requried in your xml,

  1. 2 <change> tag not required. use one and add the condition inside <change><condition>..</condition> <condition> </condition></change>
  2. lowest use lower case in the depends


    Top5
    lowest
    Showpanel
    Showpanel



    true




    true




    Top 5 Indexes



    $query$
    $myTimePickerToken.earliest$
    $myTimePickerToken.latest$



    Index with least License usage



    $query2$
    $myTimePickerToken.earliest$
    $myTimePickerToken.latest$


V
0 Karma

vnravikumar
Champion

Hi @bhaskarasplunk

Try this and let me know

<form>
  <fieldset submitButton="false" autoRun="false">
    <input type="dropdown" token="field1">
      <label>field1</label>
      <choice value="top">Top5</choice>
      <choice value="lowest">Lowest</choice>
      <change>
        <condition value="top">
          <set token="showTop5">true</set>
          <unset token="showLowest"></unset>
        </condition>
        <condition value="lowest">
          <set token="showLowest">true</set>
          <unset token="showTop5"></unset>
        </condition>
        <condition>
          <unset token="showLowest"></unset>
          <unset token="showTop5"></unset>
        </condition>
      </change>
    </input>
  </fieldset>
  <row>
    <panel depends="$showTop5$" rejects="$showLowest$">
      <title>Top 5 Indexes</title>
      <table>
        <search>
          <query>$query$ </query>
          <earliest>$myTimePickerToken.earliest$</earliest>
          <latest>$myTimePickerToken.latest$</latest>
        </search>
      </table>
    </panel>
    <panel depends="$showLowest$" rejects="$showTop5$">
      <title>Index with least License usage</title>
      <table>
        <search>
          <query>$query2$</query>
          <earliest>$myTimePickerToken.earliest$</earliest>
          <latest>$myTimePickerToken.latest$</latest>
        </search>
      </table>
    </panel>
  </row>
</form>

bhaskarasplunk
Explorer

Hi Kumar,

Thank you so much!

It worked for me.

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!

Observe and Secure All Apps with Splunk

 Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

What's New in Splunk Observability - August 2025

What's New We are excited to announce the latest enhancements to Splunk Observability Cloud as well as what is ...

Introduction to Splunk AI

How are you using AI in Splunk? Whether you see AI as a threat or opportunity, AI is here to stay. Lucky for ...