Dashboards & Visualizations

How to initialize a token value

anooshac
Communicator

Hello all,
I want to initialize a token value. That is while dashboard is opened that value should be initialized to the token. I have tried writing the token value inside "init". I want to compute the token value in the "init" method, i tried and there is no change. How can i achieve this?

Tags (3)
0 Karma
1 Solution

vnravikumar
Champion

Hi

Check this

<dashboard>
  <label>init</label>
  <init>
    <eval token="temp">1+2</eval>
  </init>
  <row>
    <html>
      $temp$
    </html>
  </row>
</dashboard>

Please post your xml.

[updated]

Try by getting the max number in query and set it in a token.

<dashboard>
   <label>max number</label>
   <search>
     <query>
       | makeresults 
 | eval temp="12,33,444,66" 
 | makemv delim="," temp 
 | stats max(temp) as num

     </query>
     <done>
       <set token="max_num">$result.num$</set>
     </done>
   </search>
   <row>
     <html>
       maximum number: $max_num$
     </html>
   </row>
 </dashboard>

View solution in original post

anooshac
Communicator

HI @vnravikumar , can i use where command to print the fields which of $max_num$?
I have tried it and not getting any result. My file is in json format.

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!

[Puzzles] Solve, Learn, Repeat: Matching cron expressions

This puzzle (first published here) is based on matching timestamps to cron expressions.All the timestamps ...

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas     Cisco Live 2026 is almost here, and this ...

Data Management Digest – May 2026

Welcome to the May 2026 edition of Data Management Digest!   As your trusted partner in data innovation, the ...