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.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

What Is Splunk? Here’s What You Can Do with Splunk

Hey Splunk Community, we know you know Splunk. You likely leverage its unparalleled ability to ingest, index, ...

Level Up Your .conf25: Splunk Arcade Comes to Boston

With .conf25 right around the corner in Boston, there’s a lot to look forward to — inspiring keynotes, ...

Manual Instrumentation with Splunk Observability Cloud: How to Instrument Frontend ...

Although it might seem daunting, as we’ve seen in this series, manual instrumentation can be straightforward ...