Dashboards & Visualizations

How do you display the Name of a value from a drop down filter list?

jason_hotchkiss
Communicator

I would like to display the Name of a drop down option in the label of a panel.  The token for the drop down filter is $value$.  How would I display the Name, such as MY VALUE 1, MY VALUE 2, etc. as a token?  I tried label.$value$ and that did not work for me.

jason_hotchkiss_0-1714755852339.png

 

 

Labels (2)
0 Karma
1 Solution

jason_hotchkiss
Communicator

I ended up taking the suggestion I received on the slack channels of using the <change> block and setting a token.  

<panel>
      <title>Top 25 by $label$</title>
<input type="dropdown" token="split_by" searchWhenChanged="true">
        <label>Split by</label>
        <change>
          <condition value="value1">
            <set token="label">MY VALUE 1</set>
          </condition>
          <condition value="value2">
            <set token="label">MY VALUE 2</set>
          </condition>
          <condition value="value3">
            <set token="label">MY VALUE 3</set>
          </condition>
          </change>
        <choice value="value1">MY VALUE 1</choice>
        <choice value="value2">MY VALUE 2</choice>
        <choice value="value3">MY VALUE 3</choice>
        <default>value1</default>
        <initialValue>value1</initialValue>
        <fieldForLabel>split_by</fieldForLabel>
        <fieldForValue>split_by</fieldForValue>
      </input>
      <chart>
        <search>
          <query></query>
        </search>
       </chart>
    </panel>

 

View solution in original post

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @jason_hotchkiss,

instead using static values, you could use a search like the following:

| makeresults 
| eval my_field="MyValue1"
| append [
     | makeresults 
     | eval my_field="MyValue2" ]
| append [
     | makeresults 
     | eval my_field="MyValue3" ]
| sort my_field
| table my_field

in this way, you can use the field "my_field" as the values in the token.

Ciao,

Giuseppe

jason_hotchkiss
Communicator

I ended up taking the suggestion I received on the slack channels of using the <change> block and setting a token.  

<panel>
      <title>Top 25 by $label$</title>
<input type="dropdown" token="split_by" searchWhenChanged="true">
        <label>Split by</label>
        <change>
          <condition value="value1">
            <set token="label">MY VALUE 1</set>
          </condition>
          <condition value="value2">
            <set token="label">MY VALUE 2</set>
          </condition>
          <condition value="value3">
            <set token="label">MY VALUE 3</set>
          </condition>
          </change>
        <choice value="value1">MY VALUE 1</choice>
        <choice value="value2">MY VALUE 2</choice>
        <choice value="value3">MY VALUE 3</choice>
        <default>value1</default>
        <initialValue>value1</initialValue>
        <fieldForLabel>split_by</fieldForLabel>
        <fieldForValue>split_by</fieldForValue>
      </input>
      <chart>
        <search>
          <query></query>
        </search>
       </chart>
    </panel>

 

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @jason_hotchkiss ,

good for you, see next time!

let me know if I can help you more, or, please, accept one answer for the other people of Community.

Ciao and happy splunking

Giuseppe

P.S.: Karma Points are appreciated 😉

0 Karma
Get Updates on the Splunk Community!

Accelerating Observability as Code with the Splunk AI Assistant

We’ve seen in previous posts what Observability as Code (OaC) is and how it’s now essential for managing ...

Integrating Splunk Search API and Quarto to Create Reproducible Investigation ...

 Splunk is More Than Just the Web Console For Digital Forensics and Incident Response (DFIR) practitioners, ...

Congratulations to the 2025-2026 SplunkTrust!

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