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
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas     Cisco Live 2026 is almost here, and this ...

What Is the Name of the USB Key Inserted by Bob Smith? (BOTS Hint, Not the Answer)

Hello Splunkers,   So you searched, “what is the name of the usb key inserted by bob smith?”  Not gonna lie… ...

Automating Threat Operations and Threat Hunting with Recorded Future

    Automating Threat Operations and Threat Hunting with Recorded Future June 29, 2026 | Register   Is your ...