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!

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...