Dashboards & Visualizations

.

iegus
Loves-to-Learn Lots

.

Labels (3)
0 Karma

bowesmana
SplunkTrust
SplunkTrust

There are a couple of issues with your existing statements in that you are using $value$ in the condition and looking for "Todos", which is actually $label$ and not the value, which you have set to *.

It's not clear if you need the $Select$ token for the input to be the value of the input, but on the basis that you are using the $Select$ token elsewhere, you can get rid of the condition statements and use a simple set of eval statements for your token setters. 

The example below only needs 2 <eval> token statements to set the pane dependent tokens. Setting a token to null() is the same as unsetting it, so you don't need <condition>. 

Note the use of $value$ and $label$ in the eval as it's tricky to compare a value of "*" which is the value of the Todos option.

<form>
  <label>tmp11</label>
  <row>
    <panel>
      <input type="dropdown" token="Select">
      <label>Select</label>
      <choice value="*">Todos</choice>
      <choice value="Tabela">Tabela</choice>
      <choice value="Gráfico">Gráfico</choice>
      <default>Todos</default>
      <change>
        <eval token="Tabela">if($value$="Tabela" OR $label$="Todos", "", null())</eval>
        <eval token="Gráfico">if($value$="Gráfico" OR $label$="Todos", "", null())</eval>
      </change>
      </input>      
    </panel>
    <panel depends="$Gráfico$">
      <html>
        <h1>Gráfico</h1>
        <p>Select token is $Select$</p>
      </html>
    </panel>
    <panel depends="$Tabela$">
      <html>
        <h1>Tabela</h1>
        <p>Select token is $Select$</p>
      </html>
    </panel>
  </row>
</form>

 

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @iegus ,

the answer from @michael_bates_1 is correct,

in addition, you could see in the Splunk Dashboard Examples app (https://splunkbase.splunk.com/app/1603) where you can find an example and the description about your requirement.

Ciao.

Giuseppe

0 Karma

michael_bates_1
Path Finder

Hi, here is a working skeleton that shows the concept.

<form version="1.1">
  <label>Sample Dropdown Selector</label>
  <fieldset submitButton="false">
    <input type="dropdown" token="select">
      <label>select</label>
      <choice value="All">All</choice>
      <choice value="Table">Table</choice>
      <choice value="Single">Single</choice>
      <choice value="Graph">Graph</choice>
      <choice value="None">None</choice>
      <default>None</default>
      <initialValue>None</initialValue>
<change>
<condition value="All">
<set token="Table"></set>
<set token="Graph"></set>
<set token="Single"></set>
</condition>
<condition value="Table">
<unset token="Single"></unset>
<unset token="Graph"></unset>
<set token="Table"></set>
</condition>
<condition value="Graph">
<unset token="Table"></unset>
<unset token="Single"></unset>
<set token="Graph"></set>
</condition>
<condition value="Single">
<unset token="Table"></unset>
<set token="Single"></set>
<unset token="Graph"></unset>
</condition>
<condition value="None">
<unset token="Table"></unset>
<unset token="Single"></unset>
<unset token="Graph"></unset>
</condition>
</change>
    </input>
  </fieldset>
  <row>
    <panel depends="$Table$">
      <title>Table</title>
      <table>
        <search>
          <query>| makeresults count=10 | streamstats count | eval title="Item "+count</query>
          <earliest>-24h@h</earliest>
          <latest>now</latest>
        </search>
        <option name="drilldown">none</option>
        <option name="refresh.display">progressbar</option>
      </table>
    </panel>
    <panel depends="$Single$">
      <title>Single</title>
      <single>
        <search>
          <query>| makeresults count=10 | streamstats count</query>
          <earliest>-24h@h</earliest>
          <latest>now</latest>
        </search>
        <option name="drilldown">none</option>
      </single>
    </panel>
    <panel depends="$Graph$">
      <title>Graph</title>
      <chart>
        <search>
          <query>| makeresults count=10 | streamstats count</query>
          <earliest>-24h@h</earliest>
          <latest>now</latest>
        </search>
        <option name="charting.chart">line</option>
        <option name="charting.drilldown">none</option>
      </chart>
    </panel>
  </row>
</form>

 

0 Karma

michael_bates_1
Path Finder

Hi there. 
It looks like you dropdown logic is correct.
Set a token to display the panel, unset token to hide the panel.
To display all, simply set all tokens.
For each panel you want to hide/show, ensure you have something similar to the following

You would have a token for each of the elements you want to conditionally display; table, single, and graph.

<panel depends="$graph$">
</panel>
<panel depends=$table$">
</panel>
<panel depends=$single$">
</panel>

 

with the required elements in them

0 Karma

iegus
Loves-to-Learn Lots

Could you show me how I can include the codes you sent and how it would look?

0 Karma
Get Updates on the Splunk Community!

Enterprise Security Content Update (ESCU) | New Releases

In December, the Splunk Threat Research Team had 1 release of new security content via the Enterprise Security ...

Why am I not seeing the finding in Splunk Enterprise Security Analyst Queue?

(This is the first of a series of 2 blogs). Splunk Enterprise Security is a fantastic tool that offers robust ...

Index This | What are the 12 Days of Splunk-mas?

December 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...