Dashboards & Visualizations

Multiple user input visualization

patilsh
Explorer

Hello All,

I want to create a dashboard, such that the visualization that should be shown depends on user Input.

Suppose user selects say option 1, Visualization 'a' should be displayed on dashboard, if user chooses option 2 then visualization 'b' should be displayed on dashboard and so on.

Can some please let me know how to proceed , as I have never done this before.

Regards
Shailendra Patil

0 Karma
1 Solution

cmerriman
Super Champion

this blog post might help you find your solution. https://www.splunk.com/blog/2017/06/29/load-em-up-and-move-em-out-controlling-dashboard-panel-load-o...
You need to set up an input with choices and then set new tokens for each value of the input. Then use those new tokens as the depends.

View solution in original post

niketn
Legend

@patilsh, Refer to following Splunk documentation on using depends and rejects you can show/hide Simple XML elements in Splunk like Panel, Visualizations, Input, Row etc: https://docs.splunk.com/Documentation/Splunk/latest/Viz/ContextualDrilldown#Show_or_hide_content

You can also download Splunk 6.x Dashboard Examples App from Splunkbase and refer to Null Search Swapper example to understand both.

Following is an example which switches between three HTML Panels using value selected through Radio Input control

<form>
  <label>Splunk Answers 568368 - Show Hide Panel content</label>
  <fieldset submitButton="false">
    <input type="radio" token="tokShowHidePanel" searchWhenChanged="true">
      <label>Select Panel to be displayed</label>
      <choice value="panel1">Panel 1</choice>
      <choice value="panel2">Panel 2</choice>
      <choice value="panel3">Panel 3</choice>
      <change>
        <!-- Input Change Event Handler to set token for only selected panel and unset remaining-->
        <condition value="panel1">
          <set token="showPanel1">true</set>
          <unset token="showPanel2"></unset>
          <unset token="showPanel3"></unset>
        </condition>
        <condition value="panel2">
          <unset token="showPanel1"></unset>
          <set token="showPanel2">true</set>
          <unset token="showPanel3"></unset>
        </condition>
        <condition value="panel3">
          <unset token="showPanel1"></unset>
          <unset token="showPanel2"></unset>
          <set token="showPanel3"></set>
        </condition>
      </change>
      <default>panel1</default>
    </input>
  </fieldset>
  <row>
    <panel depends="$showPanel1$">
      <html>
        <h2 style="color:red;">Showing Panel 1</h2>
      </html>
    </panel>
    <panel depends="$showPanel2$">
      <html>
        <h2 style="color:blue;">Showing Panel 2</h2>
      </html>
    </panel>
    <panel depends="$showPanel3$">
      <html>
        <h2 style="color:green;">Showing Panel 3</h2>
      </html>
    </panel>
  </row>
</form>
____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

cmerriman
Super Champion

this blog post might help you find your solution. https://www.splunk.com/blog/2017/06/29/load-em-up-and-move-em-out-controlling-dashboard-panel-load-o...
You need to set up an input with choices and then set new tokens for each value of the input. Then use those new tokens as the depends.

patilsh
Explorer

That was a great blog. It helped a lot.
Thanks for the help

0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...