<?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 Re: How to import the token value in the JavaScript in Simple XML? in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-import-the-token-value-in-the-JavaScript-in-Simple-XML/m-p/121699#M7119</link>
    <description>&lt;P&gt;Ok yes it has a default setting, ah i didn't has the splunkjs/ready! in the require statement.&lt;BR /&gt;
Now it looks like it's working. But now i want to add behavior to the time input like on change&lt;/P&gt;</description>
    <pubDate>Wed, 13 Jan 2016 14:20:36 GMT</pubDate>
    <dc:creator>joao_amorim</dc:creator>
    <dc:date>2016-01-13T14:20:36Z</dc:date>
    <item>
      <title>How to import the token value in the JavaScript in Simple XML?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-import-the-token-value-in-the-JavaScript-in-Simple-XML/m-p/121679#M7099</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/472i551D79578DFE7FFC/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;BR /&gt;
Create a wish come test.js code to get the value of $ time_ok1.earliest $.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jul 2015 08:39:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-import-the-token-value-in-the-JavaScript-in-Simple-XML/m-p/121679#M7099</guid>
      <dc:creator>kedjjang</dc:creator>
      <dc:date>2015-07-14T08:39:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to import the token value in the JavaScript in Simple XML?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-import-the-token-value-in-the-JavaScript-in-Simple-XML/m-p/121680#M7100</link>
      <description>&lt;P&gt;In test.js, you need to require the right components, and then you can simply grab the tokens from the token model. Something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; require([
     'splunkjs/mvc/simplexml/ready!',
     "splunkjs/mvc"
 ],
 function(
     mvc
     ) {
         // Get the default model
         var defaultTokenModel = splunkjs.mvc.Components.getInstance("default");
         // Get some token from there
         var token_kang = defaultTokenModel.get("kang");
         ...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;See &lt;A href="http://dev.splunk.com/view/SP-CAAAEW3" target="_blank"&gt;here&lt;/A&gt; for the docs. Be aware though that the object "token_kang" at the moment contains two fields, and to get to the &lt;CODE&gt;earliest&lt;/CODE&gt; in js, you need to do &lt;CODE&gt;token_kang.earliest&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 06:40:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-import-the-token-value-in-the-JavaScript-in-Simple-XML/m-p/121680#M7100</guid>
      <dc:creator>jeffland</dc:creator>
      <dc:date>2020-09-29T06:40:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to import the token value in the JavaScript in Simple XML?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-import-the-token-value-in-the-JavaScript-in-Simple-XML/m-p/121681#M7101</link>
      <description>&lt;P&gt;It appears to be undefined.&lt;/P&gt;

&lt;P&gt;splunkjs.mvc.Components.getInstance ("default");&lt;/P&gt;

&lt;P&gt;Will that be called justice in simplexml default?&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jul 2015 09:36:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-import-the-token-value-in-the-JavaScript-in-Simple-XML/m-p/121681#M7101</guid>
      <dc:creator>kedjjang</dc:creator>
      <dc:date>2015-07-14T09:36:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to import the token value in the JavaScript in Simple XML?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-import-the-token-value-in-the-JavaScript-in-Simple-XML/m-p/121682#M7102</link>
      <description>&lt;P&gt;What exactly is undefined?&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jul 2015 09:37:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-import-the-token-value-in-the-JavaScript-in-Simple-XML/m-p/121682#M7102</guid>
      <dc:creator>jeffland</dc:creator>
      <dc:date>2015-07-14T09:37:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to import the token value in the JavaScript in Simple XML?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-import-the-token-value-in-the-JavaScript-in-Simple-XML/m-p/121683#M7103</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;require(["splunkjs/ready!"], function(mvc) {
var deps = [
        "jquery",
        "splunkjs/ready!",      
        "splunkjs/mvc/searchmanager",
    ];
    require(deps, function(mvc) {               

    var defaultTokenModel = splunkjs.mvc.Components.getInstance("default");
    var token_def = defaultTokenModel.get("kang");

    alert(token_def);  &amp;lt;&amp;lt; undefined
    console.log(token_def);
});
});
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 14 Jul 2015 09:41:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-import-the-token-value-in-the-JavaScript-in-Simple-XML/m-p/121683#M7103</guid>
      <dc:creator>kedjjang</dc:creator>
      <dc:date>2015-07-14T09:41:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to import the token value in the JavaScript in Simple XML?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-import-the-token-value-in-the-JavaScript-in-Simple-XML/m-p/121684#M7104</link>
      <description>&lt;P&gt;Oh, my bad. I mistook your id and token name. It has to be&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;var token_def = defaultTokenModel.get("time_ok1");
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Sorry!&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jul 2015 14:10:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-import-the-token-value-in-the-JavaScript-in-Simple-XML/m-p/121684#M7104</guid>
      <dc:creator>jeffland</dc:creator>
      <dc:date>2015-07-14T14:10:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to import the token value in the JavaScript in Simple XML?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-import-the-token-value-in-the-JavaScript-in-Simple-XML/m-p/121685#M7105</link>
      <description>&lt;P&gt;You're welcome...&lt;/P&gt;

&lt;P&gt;"time_ok1" Even if I value the results.&lt;BR /&gt;
I think that haneunge "default" settings on the source code ... I do not know anything.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jul 2015 00:24:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-import-the-token-value-in-the-JavaScript-in-Simple-XML/m-p/121685#M7105</guid>
      <dc:creator>kedjjang</dc:creator>
      <dc:date>2015-07-15T00:24:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to import the token value in the JavaScript in Simple XML?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-import-the-token-value-in-the-JavaScript-in-Simple-XML/m-p/121686#M7106</link>
      <description>&lt;P&gt;I'm sorry, I don't quite get what you're saying - is something still not working?&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jul 2015 06:40:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-import-the-token-value-in-the-JavaScript-in-Simple-XML/m-p/121686#M7106</guid>
      <dc:creator>jeffland</dc:creator>
      <dc:date>2015-07-15T06:40:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to import the token value in the JavaScript in Simple XML?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-import-the-token-value-in-the-JavaScript-in-Simple-XML/m-p/121687#M7107</link>
      <description>&lt;P&gt;Thank you.&lt;/P&gt;

&lt;P&gt;Fixed with respect to this issue.&lt;/P&gt;

&lt;P&gt;var tokens = mvc.Components.getInstance ("kang");&lt;BR /&gt;
var defaultEtime = tokens.options.default.earliest_time;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jul 2015 06:48:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-import-the-token-value-in-the-JavaScript-in-Simple-XML/m-p/121687#M7107</guid>
      <dc:creator>kedjjang</dc:creator>
      <dc:date>2015-07-15T06:48:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to import the token value in the JavaScript in Simple XML?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-import-the-token-value-in-the-JavaScript-in-Simple-XML/m-p/121688#M7108</link>
      <description>&lt;P&gt;Hi this var token_def = defaultTokenModel.get("time_ok1");&lt;BR /&gt;
Doesn't work for me. Any idea?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 08:24:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-import-the-token-value-in-the-JavaScript-in-Simple-XML/m-p/121688#M7108</guid>
      <dc:creator>joao_amorim</dc:creator>
      <dc:date>2020-09-29T08:24:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to import the token value in the JavaScript in Simple XML?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-import-the-token-value-in-the-JavaScript-in-Simple-XML/m-p/121689#M7109</link>
      <description>&lt;P&gt;Is your token named &lt;CODE&gt;time_ok1&lt;/CODE&gt;?&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jan 2016 09:05:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-import-the-token-value-in-the-JavaScript-in-Simple-XML/m-p/121689#M7109</guid>
      <dc:creator>jeffland</dc:creator>
      <dc:date>2016-01-13T09:05:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to import the token value in the JavaScript in Simple XML?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-import-the-token-value-in-the-JavaScript-in-Simple-XML/m-p/121690#M7110</link>
      <description>&lt;P&gt;No i have the token with other name but i don't know why the only one that doesn't work is the tokens of the time input, the others work fine....&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jan 2016 09:57:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-import-the-token-value-in-the-JavaScript-in-Simple-XML/m-p/121690#M7110</guid>
      <dc:creator>joao_amorim</dc:creator>
      <dc:date>2016-01-13T09:57:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to import the token value in the JavaScript in Simple XML?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-import-the-token-value-in-the-JavaScript-in-Simple-XML/m-p/121691#M7111</link>
      <description>&lt;P&gt;That's because the time tokens are special, they are objects containing two fields: earliest and latest (as already stated in the answer above). You should be able to get them with &lt;CODE&gt;token_name.earliest&lt;/CODE&gt; or &lt;CODE&gt;token_name.earliest_time&lt;/CODE&gt;, or as kedjjang mentioned with &lt;CODE&gt;your_token.optionsdefault.earliest_time&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jan 2016 10:05:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-import-the-token-value-in-the-JavaScript-in-Simple-XML/m-p/121691#M7111</guid>
      <dc:creator>jeffland</dc:creator>
      <dc:date>2016-01-13T10:05:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to import the token value in the JavaScript in Simple XML?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-import-the-token-value-in-the-JavaScript-in-Simple-XML/m-p/121692#M7112</link>
      <description>&lt;P&gt;Ok i tried only the token_name.earliest and it works but only after i change the time, because the first time that i open the dashboard it can't get the value of the token_name.earliest.&lt;BR /&gt;
When you open the dashboard the value of earliest and latest of the time token are undefined and I don't know why cause all the other are working correctly.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 08:22:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-import-the-token-value-in-the-JavaScript-in-Simple-XML/m-p/121692#M7112</guid>
      <dc:creator>joao_amorim</dc:creator>
      <dc:date>2020-09-29T08:22:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to import the token value in the JavaScript in Simple XML?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-import-the-token-value-in-the-JavaScript-in-Simple-XML/m-p/121693#M7113</link>
      <description>&lt;P&gt;I answered already but the answer did was posted here&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jan 2016 11:16:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-import-the-token-value-in-the-JavaScript-in-Simple-XML/m-p/121693#M7113</guid>
      <dc:creator>joao_amorim</dc:creator>
      <dc:date>2016-01-13T11:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to import the token value in the JavaScript in Simple XML?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-import-the-token-value-in-the-JavaScript-in-Simple-XML/m-p/121694#M7114</link>
      <description>&lt;P&gt;When i open the dashboard the only tokens that don't work are these related to time inputs because the others work fine. As I have the tokens set are working but just after i change the time input to other date. The first time the dashboard loads, the get of the earliest and latest gives undefined&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jan 2016 11:18:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-import-the-token-value-in-the-JavaScript-in-Simple-XML/m-p/121694#M7114</guid>
      <dc:creator>joao_amorim</dc:creator>
      <dc:date>2016-01-13T11:18:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to import the token value in the JavaScript in Simple XML?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-import-the-token-value-in-the-JavaScript-in-Simple-XML/m-p/121695#M7115</link>
      <description>&lt;P&gt;Why the answers are not being posted here&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jan 2016 11:20:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-import-the-token-value-in-the-JavaScript-in-Simple-XML/m-p/121695#M7115</guid>
      <dc:creator>joao_amorim</dc:creator>
      <dc:date>2016-01-13T11:20:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to import the token value in the JavaScript in Simple XML?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-import-the-token-value-in-the-JavaScript-in-Simple-XML/m-p/121696#M7116</link>
      <description>&lt;P&gt;When i open the dashboard the only tokens that don't work are these related to time inputs because the others work fine. As I have the tokens set are working but just after i change the time input to other date. The first time the dashboard loads, the get of the earliest and latest gives undefined&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jan 2016 11:20:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-import-the-token-value-in-the-JavaScript-in-Simple-XML/m-p/121696#M7116</guid>
      <dc:creator>joao_amorim</dc:creator>
      <dc:date>2016-01-13T11:20:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to import the token value in the JavaScript in Simple XML?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-import-the-token-value-in-the-JavaScript-in-Simple-XML/m-p/121697#M7117</link>
      <description>&lt;P&gt;I already posted 5 times the answer but it wasn't posting it here i don't know why.&lt;BR /&gt;
The answer is in the next comment&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jan 2016 11:21:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-import-the-token-value-in-the-JavaScript-in-Simple-XML/m-p/121697#M7117</guid>
      <dc:creator>joao_amorim</dc:creator>
      <dc:date>2016-01-13T11:21:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to import the token value in the JavaScript in Simple XML?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-import-the-token-value-in-the-JavaScript-in-Simple-XML/m-p/121698#M7118</link>
      <description>&lt;P&gt;Your comment might not be published immediately because it is in moderation.&lt;BR /&gt;
Two things: have you surrounded your js in a &lt;CODE&gt;splunkjs/ready!&lt;/CODE&gt;-require statement? That should ensure everything is loaded before your code runs. Also, does your input have a default setting?&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jan 2016 12:06:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-import-the-token-value-in-the-JavaScript-in-Simple-XML/m-p/121698#M7118</guid>
      <dc:creator>jeffland</dc:creator>
      <dc:date>2016-01-13T12:06:41Z</dc:date>
    </item>
  </channel>
</rss>

