Dashboards & Visualizations

Dynamic drilldown - set default token value

snemiro_514
Path Finder

My dashboard has a timechart and a table. When the user clicks on a table serie label, the table displays events.

My table has a dependency on the token, so until the user doesn't click, it doesn't show...

I want to have the table always on display.

Is there any way to define a default value for the token?
I've tried this....to remove the dependency and do an | eval tempvalue=ifnotnull($type_tok$, "VALUE", $type_tok$) | ... (using tempvalue)

but it didn't work.

Thanks!!

< table depends="$type_tok$">

< title>Last $type_tok$< /title>

< searchString>| datamodel TEST OBJ1 search | search OBJ1.Result=$type_tok$| table _time, User, Access, LTime< /searchString>

< option name="type">list< /option>

< option name="drilldown">none< /option>

< option name="count">5< /option>

< /table>

Tags (3)

Lowell
Super Champion

In Splunk 6.5 this is now supported natively in Simple XML. See the Set tokens on page load. Example below:

<form>
   <init>
     <set token="myToken">initialValue</set>
  </init>
...
</form>

somesoni2
Revered Legend

Try this.

<form>
  <label>TestDynamicDropdown</label>
  <fieldset submitButton="false" autoRun="true">
   <input type="text" token="sourcetype">
      <label>field10</label>
      <default>splunkd</default>
     <seed>splunkd</seed>
    </input>
    <html>
       <style>
         .input#field1 {
           display: none;
         } 
    </style>

    </html>
</fieldset>
  <row>
    <panel>
      <table>
        <searchString>index=_internal | stats count by sourcetype</searchString>
        <earliestTime>-60m@m</earliestTime>
        <latestTime>now</latestTime>
        <option name="wrap">true</option>
        <option name="rowNumbers">false</option>
        <option name="dataOverlayMode">none</option>
        <option name="drilldown">row</option>
        <option name="count">10</option>
        <drilldown>
          <set token="sourcetype">$row.sourcetype$</set>
        </drilldown>
      </table>
      <table id="detail" depends="$sourcetype$">
        <searchString>index=_internal $sourcetype$| stats count by sourcetype</searchString>
        <earliestTime>-60m@m</earliestTime>
        <latestTime>now</latestTime>
        <option name="wrap">true</option>
        <option name="rowNumbers">false</option>
        <option name="dataOverlayMode">none</option>
        <option name="drilldown">cell</option>
        <option name="count">10</option>        
      </table>
    </panel>
  </row>
</form>

vcgamesii
Explorer

Description: Make an input field that has a default value for the token so it is set and the 1st search runs.

0 Karma

abhishekgupta61
Engager

Hi Team,

I have requirement to set default/Initial token value dynamically while form load.
Below search script I have to fetch the color.

search...| table color

The requirement is to set the background color for panel dynamically based on the search script. I don't want to click on any button or dropdown to set the color.

0 Karma

dfoster_splunk
Splunk Employee
Splunk Employee

Assuming this is a Simple XML page, you can add a JS extension that sets the token on page load.

The dashboard:

<dashboard script="my_dashboard.js">

The JS file:

require(['splunkjs/ready!'], function(mvc) {
    var tokens = mvc.Components.get('default');
    tokens.set('myToken', 'initialValue');
});

Lowell
Super Champion

I think the require in the above example is missing "splunkjs/mvc", like so:

require(["splunkjs/mvc", "splunkjs/mvc/simplexml/ready!"], ...

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Accelerate Splunk App Development with AI

  Learn how to automate the repetitive parts of your build cycle.   Watch On-Demand   Replay the Accelerate ...

Splunk Agent Observability: Measuring AI Value with Splunk Tokenomics on AWS

The AI landscape is moving faster than ever, and our latest 2026 State of Observability report provides the ...

Enterprise Security Watch Party: What’s New in 8.8 - Recap

Splunk Community HQ hosted a Splunk Enterprise Security Watch Party: What’s New In ES 8.8 last Thursday. I had ...