<?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 SplunkJS/HTML Dashboards + map command + $foo$ substitution in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/SplunkJS-HTML-Dashboards-map-command-foo-substitution/m-p/261772#M16471</link>
    <description>&lt;P&gt;So I'm trying to have a map command within a Simple XML dashboard. However, tokens work differently, causing my panel that has the map command to not display any information, and fails with "Waiting for Input".&lt;/P&gt;

&lt;P&gt;Example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;panel&amp;gt;&amp;lt;table&amp;gt;&amp;lt;search base="some_preproccesed_search"&amp;gt;&amp;lt;query&amp;gt;map [ search $field_from_base_search$]&amp;lt;/query&amp;gt;&amp;lt;/search&amp;gt;&amp;lt;/table&amp;gt;&amp;lt;/panel&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But since &lt;CODE&gt;$field_from_base_search$&lt;/CODE&gt; doesn't exist as a token in the dashboard, it sits and waits for input! Oh My! Whatever shall I do!?&lt;/P&gt;

&lt;P&gt;(original question here: &lt;A href="https://answers.splunk.com/answers/119666/splunkjs-html-dashboards-map-command-foo-substitution.html"&gt;https://answers.splunk.com/answers/119666/splunkjs-html-dashboards-map-command-foo-substitution.html&lt;/A&gt;)&lt;/P&gt;</description>
    <pubDate>Thu, 20 Oct 2016 18:21:21 GMT</pubDate>
    <dc:creator>alacercogitatus</dc:creator>
    <dc:date>2016-10-20T18:21:21Z</dc:date>
    <item>
      <title>SplunkJS/HTML Dashboards + map command + $foo$ substitution</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/SplunkJS-HTML-Dashboards-map-command-foo-substitution/m-p/261772#M16471</link>
      <description>&lt;P&gt;So I'm trying to have a map command within a Simple XML dashboard. However, tokens work differently, causing my panel that has the map command to not display any information, and fails with "Waiting for Input".&lt;/P&gt;

&lt;P&gt;Example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;panel&amp;gt;&amp;lt;table&amp;gt;&amp;lt;search base="some_preproccesed_search"&amp;gt;&amp;lt;query&amp;gt;map [ search $field_from_base_search$]&amp;lt;/query&amp;gt;&amp;lt;/search&amp;gt;&amp;lt;/table&amp;gt;&amp;lt;/panel&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But since &lt;CODE&gt;$field_from_base_search$&lt;/CODE&gt; doesn't exist as a token in the dashboard, it sits and waits for input! Oh My! Whatever shall I do!?&lt;/P&gt;

&lt;P&gt;(original question here: &lt;A href="https://answers.splunk.com/answers/119666/splunkjs-html-dashboards-map-command-foo-substitution.html"&gt;https://answers.splunk.com/answers/119666/splunkjs-html-dashboards-map-command-foo-substitution.html&lt;/A&gt;)&lt;/P&gt;</description>
      <pubDate>Thu, 20 Oct 2016 18:21:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/SplunkJS-HTML-Dashboards-map-command-foo-substitution/m-p/261772#M16471</guid>
      <dc:creator>alacercogitatus</dc:creator>
      <dc:date>2016-10-20T18:21:21Z</dc:date>
    </item>
    <item>
      <title>Re: SplunkJS/HTML Dashboards + map command + $foo$ substitution</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/SplunkJS-HTML-Dashboards-map-command-foo-substitution/m-p/261773#M16472</link>
      <description>&lt;P&gt;Well, Me, I'll tell you! New in Splunk 6.5, you can set tokens on dashboard initialization. Why is this important? Because you can set a token with the string of the token in the search! Is it pretty? Nope. Does it work? Yep!&lt;/P&gt;

&lt;P&gt;Add this to the beginning of the dashboard:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;init&amp;gt;&amp;lt;set token="map_token"&amp;gt;&amp;lt;![CDATA[$field_from_base_search$]]&amp;gt;&amp;lt;/set&amp;gt;&amp;lt;/init&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;CODE&gt;NOTE&lt;/CODE&gt;: You need the CDATA in order to state that this is a "string" as far as dashboard tokens go. &lt;/P&gt;

&lt;P&gt;And now your panel becomes:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;panel&amp;gt;&amp;lt;table&amp;gt;&amp;lt;search base="some_preproccesed_search"&amp;gt;&amp;lt;query&amp;gt;map [ search $map_token$]&amp;lt;/query&amp;gt;&amp;lt;/search&amp;gt;&amp;lt;/table&amp;gt;&amp;lt;/panel&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In effect, this allows the dashboard to set the token to a string, that then gets replaced when the search is executed!&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.5.0/Viz/tokens#Set_tokens_on_page_load"&gt;http://docs.splunk.com/Documentation/Splunk/6.5.0/Viz/tokens#Set_tokens_on_page_load&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Oct 2016 18:26:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/SplunkJS-HTML-Dashboards-map-command-foo-substitution/m-p/261773#M16472</guid>
      <dc:creator>alacercogitatus</dc:creator>
      <dc:date>2016-10-20T18:26:17Z</dc:date>
    </item>
  </channel>
</rss>

