Dashboards & Visualizations

Question token being used in input dropdown

Deepz2612
Explorer

Hi all,

I have a query such as below for the input drop down

<input type="dropdown" token="country" searchWhenChanged="true">
        <label>Country</label>
        <fieldForLabel>Country</fieldForLabel>
        <fieldForValue>Country</fieldForValue>
        <default>*</default>
        <initialValue>*</initialValue>
        <search>
          <query>{search}|stats count by Country_Code Country</query>
          <earliest>0</earliest>
          <latest></latest>
        </search>
      </input>

I'm able to pass only the value of Country using the token "country" to the panel.
At times I wanted to make use of Country Code value.
How to set token for Country Code also.

i.e.,when a country is selected from the dropdown its corresponding country codes I wanted to use it for the few panels in the dashboard.

Tags (1)
0 Karma

vnravikumar
Champion

Hi

Try like

<form>
  <label>dropdown</label>
  <fieldset submitButton="false">
    <input type="dropdown" token="field1">
      <label>field1</label>
      <fieldForLabel>code</fieldForLabel>
      <fieldForValue>country</fieldForValue>
      <search>
        <query>| makeresults 
| eval code=1,country="US" 
| append 
    [| makeresults 
    | eval code=2,country="Russia"]</query>
        <earliest>-24h@h</earliest>
        <latest>now</latest>
      </search>
      <change>
        <set token="code">$value$</set>
        <set token="country">$label$</set>
      </change>
    </input>
  </fieldset>
</form>
0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

What Is Splunk? Here’s What You Can Do with Splunk

Hey Splunk Community, we know you know Splunk. You likely leverage its unparalleled ability to ingest, index, ...

Level Up Your .conf25: Splunk Arcade Comes to Boston

With .conf25 right around the corner in Boston, there’s a lot to look forward to — inspiring keynotes, ...

Manual Instrumentation with Splunk Observability Cloud: How to Instrument Frontend ...

Although it might seem daunting, as we’ve seen in this series, manual instrumentation can be straightforward ...