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!

[Puzzles] Solve, Learn, Repeat: Dynamic formatting from XML events

This challenge was first posted on Slack #puzzles channelFor a previous puzzle, I needed a set of fixed-length ...

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  &#x1f680; Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Stronger Security with Federated Search for S3, GCP SQL & Australian Threat ...

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