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
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!

How to find the worst searches in your Splunk environment and how to fix them

Everyone knows Splunk is a powerful platform for running searches and doing data analytics. Your ...

Share Your Feedback: On Admin Config Service (ACS)!

Help Us Build a Better Admin Config Service Experience (ACS)   We Want Your Feedback on Admin Config Service ...

Build the Future of Agentic AI: Join the Splunk Agentic Ops Hackathon

AI is changing how teams investigate incidents, detect threats, automate workflows, and build intelligent ...