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
Get Updates on the Splunk Community!

Introducing Splunk Enterprise 9.2

WATCH HERE! Watch this Tech Talk to learn about the latest features and enhancements shipped in the new Splunk ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...