Dashboards & Visualizations

How to set token value using macro

Yolan
Explorer

Hi, 

I have some dashboard that all use the similar color visualizations for some single value panels.
Currently they are set in the init of each dashboard:

 

<init>
  <set token="rangeColors">["0xD93F3C","0xFF8000","0x53a051"]</set>
  <set token="rangeValues">[90,99]</set>
</init>

 

 In each panel that using them the options are set like this:

 

<option name="rangeColors">$rangeColors$</option>
<option name="rangeValues">$rangeValues$</option>

 

However, it is used in quite a few dashboards and the rangeValues need to be updated regularly because of changing targets.

So my idea is to create macros and set the token values using the macro, something like this:

 

<set token="rangeColors">`rangeColors`</set>

 

or

<eval token="rangeColors">`rangeColors`</eval>


Both don't seem to work, "set" just gives back a string: "`rangeColors`" and eval doesn't set a token at all.

Can someone help me with making this work?

Many thanks, 
Yolan

Labels (1)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

It won't work.  Macros are search features and, because that part of the dashboard is not running a search, macros aren't recognized.

---
If this reply helps you, Karma would be appreciated.

View solution in original post

richgalloway
SplunkTrust
SplunkTrust

It won't work.  Macros are search features and, because that part of the dashboard is not running a search, macros aren't recognized.

---
If this reply helps you, Karma would be appreciated.
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...