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
Get Updates on the Splunk Community!

Aligning Observability Costs with Business Value: Practical Strategies

 Join us for an engaging Tech Talk on Aligning Observability Costs with Business Value: Practical ...

Mastering Data Pipelines: Unlocking Value with Splunk

 In today's AI-driven world, organizations must balance the challenges of managing the explosion of data with ...

Splunk Up Your Game: Why It's Time to Embrace Python 3.9+ and OpenSSL 3.0

Did you know that for Splunk Enterprise 9.4, Python 3.9 is the default interpreter? This shift is not just a ...