<?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 store a single value search result in some variable in a Splunk HTML page to display in a javascript alert popup? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-store-a-single-value-search-result-in-some-variable-in-a/m-p/150300#M42113</link>
    <description>&lt;P&gt;Thank you so much!! It was really helpful &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 25 Jun 2015 13:53:03 GMT</pubDate>
    <dc:creator>naveen069</dc:creator>
    <dc:date>2015-06-25T13:53:03Z</dc:date>
    <item>
      <title>How to store a single value search result in some variable in a Splunk HTML page to display in a javascript alert popup?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-store-a-single-value-search-result-in-some-variable-in-a/m-p/150297#M42110</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have a dashboard in html code with one search query which provides the result in Single Numeric Value.&lt;/P&gt;

&lt;P&gt;Is there any way that I can take the result of my search in some variable?&lt;BR /&gt;
I want to display it in a JavaScript alert popup i.e. &lt;CODE&gt;alert("my search result is: " + search_result_var)&lt;/CODE&gt;.&lt;BR /&gt;
Which variable in html code of dashboard stores the search result.&lt;BR /&gt;
Please Help..!!!&lt;/P&gt;</description>
      <pubDate>Fri, 17 Apr 2015 12:00:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-store-a-single-value-search-result-in-some-variable-in-a/m-p/150297#M42110</guid>
      <dc:creator>harshal_chakran</dc:creator>
      <dc:date>2015-04-17T12:00:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to store a single value search result in some variable in a Splunk HTML page to display in a javascript alert popup?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-store-a-single-value-search-result-in-some-variable-in-a/m-p/150298#M42111</link>
      <description>&lt;P&gt;Have you tried assigning the value to a input token and call it ? might work. I had a same single value panel...i created a token and assigned the single value and then called the token like &lt;/P&gt;

&lt;P&gt;&lt;/P&gt;&lt;P&gt; value is : $single_value$&lt;/P&gt; and it displays just fine.&lt;P&gt;&lt;/P&gt;

&lt;P&gt;Hope this helps!&lt;BR /&gt;
Thanks,&lt;BR /&gt;
Raghav&lt;/P&gt;</description>
      <pubDate>Fri, 17 Apr 2015 16:31:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-store-a-single-value-search-result-in-some-variable-in-a/m-p/150298#M42111</guid>
      <dc:creator>Raghav2384</dc:creator>
      <dc:date>2015-04-17T16:31:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to store a single value search result in some variable in a Splunk HTML page to display in a javascript alert popup?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-store-a-single-value-search-result-in-some-variable-in-a/m-p/150299#M42112</link>
      <description>&lt;P&gt;One way to achieve this is put a listener on your search and then assign the value to a token. For instance if my single panel was using search1 and the token I wanted to set was "user".&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; var tokens = mvc.Components.getInstance("default");
 var singleresult=splunkjs.mvc.Components.get("search1");
     singleresult.data("results").on("data", function(results) { 
             var username = results._data['rows'][0][0];
             tokens.set("user",username);
      });
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You could then use that token or variable anywhere in your HTML. You can use it in a search as any other token by calling it with $user$ or in your script by the variable &lt;CODE&gt;alert("my search result is: " + username)&lt;/CODE&gt;.  If you're not using the alert inside the listener, you can retrieve the token value and set it as a variable anywhere else by -&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; var desiredvariable=tokens.get("user");
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 18 Apr 2015 09:02:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-store-a-single-value-search-result-in-some-variable-in-a/m-p/150299#M42112</guid>
      <dc:creator>Flynt</dc:creator>
      <dc:date>2015-04-18T09:02:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to store a single value search result in some variable in a Splunk HTML page to display in a javascript alert popup?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-store-a-single-value-search-result-in-some-variable-in-a/m-p/150300#M42113</link>
      <description>&lt;P&gt;Thank you so much!! It was really helpful &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jun 2015 13:53:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-store-a-single-value-search-result-in-some-variable-in-a/m-p/150300#M42113</guid>
      <dc:creator>naveen069</dc:creator>
      <dc:date>2015-06-25T13:53:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to store a single value search result in some variable in a Splunk HTML page to display in a javascript alert popup?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-store-a-single-value-search-result-in-some-variable-in-a/m-p/150301#M42114</link>
      <description>&lt;P&gt;@Flynt[Splunk]&lt;/P&gt;

&lt;P&gt;Thanks for your help! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Nov 2015 17:14:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-store-a-single-value-search-result-in-some-variable-in-a/m-p/150301#M42114</guid>
      <dc:creator>djfang</dc:creator>
      <dc:date>2015-11-06T17:14:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to store a single value search result in some variable in a Splunk HTML page to display in a javascript alert popup?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-store-a-single-value-search-result-in-some-variable-in-a/m-p/150302#M42115</link>
      <description>&lt;P&gt;Hi i am new to splunk, can you please give me  a sample code which i can use?&lt;/P&gt;</description>
      <pubDate>Wed, 23 Mar 2016 06:05:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-store-a-single-value-search-result-in-some-variable-in-a/m-p/150302#M42115</guid>
      <dc:creator>gun1989</dc:creator>
      <dc:date>2016-03-23T06:05:41Z</dc:date>
    </item>
  </channel>
</rss>

