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!

Dashboard Studio Challenge - Learn New Tricks, Showcase Your Skills, and Win Prizes!

Reimagine what you can do with your dashboards. Dashboard Studio is Splunk’s newest dashboard builder to ...

Introducing Edge Processor: Next Gen Data Transformation

We get it - not only can it take a lot of time, money and resources to get data into Splunk, but it also takes ...

Take the 2021 Splunk Career Survey for $50 in Amazon Cash

Help us learn about how Splunk has impacted your career by taking the 2021 Splunk Career Survey. Last year’s ...