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!

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...