Dashboards & Visualizations

Replace input with a variable

darrel989787987
New Member

Hello,

I have a dashboard created in studio (I believe), the definition is in json and I am editing it through splunk.

I need to remove a checkbox drop down (input.multiselect) and replace it with a variable containing the same values that are currently included in the multi-select.  For example, if the multi select contains bob,charlie, and marie, I need to use a variable that contains "bob,charlie,marie".

My thought is to replace the input with a variable with the same name as the token for the input so I do not have to change all the searches below, but I cannot find out how to just create a hard coded variable in the dashboard definition, is this possible? I found some examples but they are xml and im assuming an older dashboard type not created with studio.

basically, the input looks like

        "input_JjuLlsqO": {
            "options": {
                "items": [
                    {
                        "label": "bob",
                        "value": "bob"
                    },
                    {
                        "label": "juan",
                        "value": "juan"
                    }
                ],
                "token": "name"
            },
            "title": "SelectName",
            "type": "input.multiselect"
        },

 

Later on in my dashboard I use $name$ to reference the user selected values, I would like to just remove the input and instead defined a variable called "name" that I can reference like "$name$".

 

Labels (1)
0 Karma

richgalloway
SplunkTrust
SplunkTrust

In Simple XML we would use an <init> stanza to set a static token value.  The equivalent in DS is a default stanza.  See https://community.splunk.com/t5/Dashboards-Visualizations/INIT-equivalent-in-Dashboard-Studio/m-p/63...

---
If this reply helps you, Karma would be appreciated.
0 Karma

livehybrid
SplunkTrust
SplunkTrust

Hi @darrel989787987 

I think the easiest way to achieve this might be to have the input as a text input with your required token name and then set it to display in canvas, once its in canvas you can drag it out the side of the canvas so its not visible when viewing your dashboard:

livehybrid_0-1756899564874.png

 

🌟 Did this answer help you? If so, please consider:

  • Adding karma to show it was useful
  • Marking it as the solution if it resolved your issue
  • Commenting if you need any clarification

Your feedback encourages the volunteers in this community to continue contributing

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!

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

[Puzzles] Solve, Learn, Repeat: Character substitutions with Regular Expressions

This challenge was first posted on Slack #puzzles channelFor BORE at .conf23, we had a puzzle question which ...

Splunk Community Badges!

  Hey everyone! Ready to earn some serious bragging rights in the community? Along with our existing badges ...