Dashboards & Visualizations

Is It Possible To Use A Simple XML Form Input Name As A Token/Variable

sajbutler
Path Finder

Hi

I have a Simple XML dashboard with the following form input:

 <input type="dropdown" token="stat" searchWhenChanged="true">
  <label>Average Or Median:</label>
  <choice value="avg">Average</choice>
  <choice value="median">Median</choice>
  <default>avg</default>
</input>

I would like to have a variable/token in a Chart Title so that the variable changes whenever someone selects something different in the form input. I can do it with the value - In the above case I could use $stat$ in the chart (i.e. avg or median). However, what I would like to know is whether it is possible to use the Name (i.e. Average or Median) as a variable/token.

Thanks

Shaun

Tags (2)

pedromvieira
Communicator

It is possible.

Sample code:

...
      <input type="dropdown" token="stat" searchWhenChanged="true">
        <label>Statistics</label>
        <choice value="MIN">Minimum</choice>
        <choice value="MAX">Maximum</choice>
        <choice value="AVG">Average</choice>        
        <default>MIN</default>
      </input> 
...

Sample search:

        <search id="your_search_id">
          <query>
... | stats $stat$(Your_Field) ...
          </query>
        </search>
0 Karma

ngatchasandra
Builder

Please, can i have your xml code?

0 Karma
Get Updates on the Splunk Community!

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...

Combine Multiline Logs into a Single Event with SOCK: a Step-by-Step Guide for ...

Combine multiline logs into a single event with SOCK - a step-by-step guide for newbies Olga Malita The ...