Dashboards & Visualizations

How to make panel depend on token value?

Muthu_Vinith
Path Finder

I have header panels on a dashboard. Say this dropdown has a token called tok_panel. Is there a way to make the panels depend on specific values of tok_panel?

i.e., if I select "All" in the dropdown, only panel "All" should be visible instead of *. In my case i'm using Static options for all to display. Others options coming based on |stats c by field name.

Screenshot 2024-08-01 194923.png

@gcusello  @ITWhisperer  @PickleRick @richgalloway 

Labels (3)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Please share the source of your dashboard in a code block

0 Karma

Muthu_Vinith
Path Finder

 

 

 <input token="panel_tok" searchWhenChanged="true">
      <label>Vendor</label>
      <choice value="*">All</choice>
      <default>*</default>
      <initialValue>*</initialValue>
      <fieldForLabel>vendor</fieldForLabel>
      <fieldForValue>vendor</fieldForValue>
      <search>
        <query>
|stats c by vendor
</query>
        <earliest>-7d@h</earliest>
        <latest>now</latest>
      </search>

 

@ITWhisperer 

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Try something like this

<form version="1.1" theme="light">
  <label>Hidden panels</label>
  <fieldset submitButton="false">
    <input type="dropdown" token="panel_tok" searchWhenChanged="true">
      <label>Vendor</label>
      <choice value="All">All</choice>
      <default>All</default>
      <initialValue>All</initialValue>
      <fieldForLabel>Vendor</fieldForLabel>
      <fieldForValue>Vendor</fieldForValue>
      <search>
        <query>| makeresults format=csv data="Vendor
Vendor A
Vendor B"
          |stats c by Vendor</query>
        <earliest>-7d@h</earliest>
        <latest>now</latest>
      </search>
      <change>
        <condition value="All">
          <set token="vendorA">true</set>
          <set token="vendorB">true</set>
        </condition>
        <condition value="Vendor A">
          <set token="vendorA"></set>
          <unset token="vendorB"></unset>
        </condition>
        <condition value="Vendor B">
          <unset token="vendorA"></unset>
          <set token="vendorB"></set>
        </condition>
      </change>
    </input>
  </fieldset>
  <row>
    <panel depends="$vendorA$">
      <html>
        <p>Panel A</p>
      </html>
    </panel>
  </row>
  <row>
    <panel depends="$vendorB$">
      <html>
        <p>Panel B</p>
      </html>
    </panel>
  </row>
</form>

Muthu_Vinith
Path Finder

hi @ITWhisperer it doesn't work.

I've tried something like this using Appendpipe command. I can see results.
For eg:
Vendor-1      10
Vendor-2      10 
All                    20

 

|inputlookup filename.csv
| stats count by Vendor 
| appendpipe 
    [| stats sum(count) as count 
    | eval Vendor="All"]

 


But when I select All from drop-down, values are not showing in the single value. However when I select Vendor-1 values are displayed. How to fix this issue?

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

OK a bit random - why have you used appendpipe?

0 Karma

Muthu_Vinith
Path Finder

@ITWhisperer  I just tired if we can use appendpipe it will the give the sum of both values. But it does not work. When i select All it should show all instead of star and corresponding values. I'm having only one header. 

Screenshot 2024-08-04 193944.png123.png

0 Karma
Get Updates on the Splunk Community!

Index This | When is October more than just the tenth month?

October 2025 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Observe and Secure All Apps with Splunk

  Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

What’s New & Next in Splunk SOAR

 Security teams today are dealing with more alerts, more tools, and more pressure than ever.  Join us for an ...