Dashboards & Visualizations

In the dropdown Input how can I select the second Value of a list?

Path Finder

Hello there,
I need to set as a default always the second element of my list values, the value can change but I need to take always the second one.

How can I make that?
There's a way with javascript?

Thank you.


0 Karma


@marziaolla, Try the following Run anywhere dashboard example. It uses post-processing to identify the second value in the dropdown and sets the same as a token for default value.

PS: If the search for Dropdown returns only one result, the same will be set as default value. Also in case the Search does not return any results, I have used Static All option to be set as default value.

alt text

  <label>Second Value in the list</label>
 <!-- Your Search to populate the second item from the list should go here --->
  <search base="baseComponentSearch">
    <query>| head 2 | tail 1
      <!-- In case the Search does not return any results Static Option All should be selected -->
      <condition match="$job.resultCount$==0">
        <set token="tokDefaultSelectedComponent">*</set>
      <!-- Set the token using Search Event Handler's default token result.<yourFieldName> -->
      <!-- If the Search returns two or more results 2nd result will be selected -->
      <!-- If the Search returns only one result, the same will be selected -->
        <set token="tokDefaultSelectedComponent">$result.component$</set>
  <fieldset submitButton="false">
    <input type="time" token="tokTime" searchWhenChanged="true">
    <input type="dropdown" token="tokComponent" searchWhenChanged="true">
      <label>Select Component</label>
      <search id="baseComponentSearch">
        <query>index=_internal sourcetype=splunkd log_level!="INFO" earliest="$tokTime.earliest$" latest="$tokTime.latest$"
| stats count by component
| sort - count
| head 5</query>
      <choice value="*">All</choice>
          <query>index=_internal sourcetype=splunkd log_level!=INFO component="$tokComponent$"
| timechart count by component</query>
        <option name="charting.chart">line</option>
        <option name="charting.drilldown">all</option>
        <option name="refresh.display">progressbar</option>
| makeresults | eval message= "Happy Splunking!!!"
0 Karma


Any specific reason for it? Can you move the 2nd element in the first position (at populating search level) and then set the first element (which was 2nd element before) as default?

0 Karma
Get Updates on the Splunk Community!

Enterprise Security Content Update (ESCU) | New Releases

In the last month, the Splunk Threat Research Team (STRT) has had 2 releases of new security content via the ...

Announcing the 1st Round Champion’s Tribute Winners of the Great Resilience Quest

We are happy to announce the 20 lucky questers who are selected to be the first round of Champion's Tribute ...

We’ve Got Education Validation!

Are you feeling it? All the career-boosting benefits of up-skilling with Splunk? It’s not just a feeling, it's ...