<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How to set token value using macro in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-set-token-value-using-macro/m-p/535070#M36484</link>
    <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have some dashboard that all use the similar color visualizations for some single value panels.&lt;BR /&gt;Currently they are set in the init of each dashboard:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;init&amp;gt;
  &amp;lt;set token="rangeColors"&amp;gt;["0xD93F3C","0xFF8000","0x53a051"]&amp;lt;/set&amp;gt;
  &amp;lt;set token="rangeValues"&amp;gt;[90,99]&amp;lt;/set&amp;gt;
&amp;lt;/init&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;In each panel that using them the options are set like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;option name="rangeColors"&amp;gt;$rangeColors$&amp;lt;/option&amp;gt;
&amp;lt;option name="rangeValues"&amp;gt;$rangeValues$&amp;lt;/option&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, it is used in quite a few dashboards and the rangeValues need to be updated regularly because of changing targets.&lt;/P&gt;&lt;P&gt;So my idea is to create macros and set the token values using the macro, something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;set token="rangeColors"&amp;gt;`rangeColors`&amp;lt;/set&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;eval token="rangeColors"&amp;gt;`rangeColors`&amp;lt;/eval&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;Both don't seem to work, "set" just gives back a string: "`rangeColors`" and eval doesn't set a token at all.&lt;BR /&gt;&lt;BR /&gt;Can someone help me with making this work?&lt;BR /&gt;&lt;BR /&gt;Many thanks,&amp;nbsp;&lt;BR /&gt;Yolan&lt;/P&gt;</description>
    <pubDate>Thu, 07 Jan 2021 16:15:57 GMT</pubDate>
    <dc:creator>Yolan</dc:creator>
    <dc:date>2021-01-07T16:15:57Z</dc:date>
    <item>
      <title>How to set token value using macro</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-set-token-value-using-macro/m-p/535070#M36484</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have some dashboard that all use the similar color visualizations for some single value panels.&lt;BR /&gt;Currently they are set in the init of each dashboard:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;init&amp;gt;
  &amp;lt;set token="rangeColors"&amp;gt;["0xD93F3C","0xFF8000","0x53a051"]&amp;lt;/set&amp;gt;
  &amp;lt;set token="rangeValues"&amp;gt;[90,99]&amp;lt;/set&amp;gt;
&amp;lt;/init&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;In each panel that using them the options are set like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;option name="rangeColors"&amp;gt;$rangeColors$&amp;lt;/option&amp;gt;
&amp;lt;option name="rangeValues"&amp;gt;$rangeValues$&amp;lt;/option&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, it is used in quite a few dashboards and the rangeValues need to be updated regularly because of changing targets.&lt;/P&gt;&lt;P&gt;So my idea is to create macros and set the token values using the macro, something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;set token="rangeColors"&amp;gt;`rangeColors`&amp;lt;/set&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;eval token="rangeColors"&amp;gt;`rangeColors`&amp;lt;/eval&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;Both don't seem to work, "set" just gives back a string: "`rangeColors`" and eval doesn't set a token at all.&lt;BR /&gt;&lt;BR /&gt;Can someone help me with making this work?&lt;BR /&gt;&lt;BR /&gt;Many thanks,&amp;nbsp;&lt;BR /&gt;Yolan&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jan 2021 16:15:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-set-token-value-using-macro/m-p/535070#M36484</guid>
      <dc:creator>Yolan</dc:creator>
      <dc:date>2021-01-07T16:15:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to set token value using macro</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-set-token-value-using-macro/m-p/535089#M36487</link>
      <description>&lt;P&gt;It won't work.&amp;nbsp; Macros are search features and, because that part of the dashboard is not running a search, macros aren't recognized.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jan 2021 18:18:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-set-token-value-using-macro/m-p/535089#M36487</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2021-01-07T18:18:06Z</dc:date>
    </item>
  </channel>
</rss>

