<?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 pass search results to custom JavaScript module in All Apps and Add-ons</title>
    <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-to-pass-search-results-to-custom-JavaScript-module/m-p/25079#M747</link>
    <description>&lt;P&gt;If you want to do something custom where you're operating on the search result rows, then I do not think you want a splunk UI module,  but rather a custom search command. &lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/5.0.2/AdvancedDev/SearchScripts"&gt;http://docs.splunk.com/Documentation/Splunk/5.0.2/AdvancedDev/SearchScripts&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;What exactly do you want to do with the results though?   If you just want to do things with field values that are on the &lt;EM&gt;first&lt;/EM&gt; row only,  then look into the documentation for the ResultsValueSetter module.  If you just want to display field values from the search results of the first &lt;EM&gt;few&lt;/EM&gt; result rows then look into the documentation for the HTML module.   Beyond these simple use cases , operating on large numbers of result rows is really not what the User Interface layer is good at and you'll want to look at writing a custom search command. &lt;/P&gt;</description>
    <pubDate>Tue, 07 May 2013 18:52:27 GMT</pubDate>
    <dc:creator>sideview</dc:creator>
    <dc:date>2013-05-07T18:52:27Z</dc:date>
    <item>
      <title>How to pass search results to custom JavaScript module</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-to-pass-search-results-to-custom-JavaScript-module/m-p/25078#M746</link>
      <description>&lt;P&gt;In my view I am creating a table with search results&lt;BR /&gt;
&lt;PRE&gt; &lt;CODE&gt;&lt;BR /&gt;
&lt;MODULE name="Search"&gt;&lt;BR /&gt;
  &lt;OBJECT&gt;&lt;PARAM name="search" /&gt;&lt;BR /&gt;
   | eval abc = .....&lt;BR /&gt;
   | eval def = .....&lt;BR /&gt;
   | eval ghi = .....&lt;BR /&gt;
   | table abc, def, ghi&lt;BR /&gt;
  &lt;BR /&gt;
  &lt;MODULE name="SimpleResultsTable"&gt;&lt;/MODULE&gt;&lt;BR /&gt;
&lt;/OBJECT&gt;&lt;/MODULE&gt;&lt;BR /&gt;
&lt;/CODE&gt; &lt;/PRE&gt;&lt;/P&gt;

&lt;P&gt;Now I want to define custom module in same view and pass search results (Ex: abc, def, ghi) to custom module JavaScript code. How can I do that? I am not using JS SDK. &lt;/P&gt;

&lt;P&gt;Ex: sample custom module in view&lt;BR /&gt;
&lt;PRE&gt; &lt;CODE&gt;&lt;BR /&gt;
    &lt;MODULE name="CustomBehavior"&gt;&lt;BR /&gt;
      &lt;OBJECT&gt;&lt;PARAM name="customBehavior" /&gt;doSomethingWithResults&lt;BR /&gt;
     &lt;/OBJECT&gt;&lt;/MODULE&gt;&lt;BR /&gt;
&lt;/CODE&gt; &lt;/PRE&gt;&lt;/P&gt;

&lt;P&gt;Ex: sample custom code in application.js&lt;BR /&gt;
&lt;PRE&gt; &lt;CODE&gt;&lt;BR /&gt;
Sideview.utils.declareCustomBehavior("doSomethingWithResults", function(customBehaviorModule) {&lt;BR /&gt;
???????&lt;BR /&gt;
???????&lt;BR /&gt;
???????&lt;BR /&gt;
// Here I want to read search results "abc","def","ghi"....&lt;BR /&gt;
});&lt;BR /&gt;
&lt;/CODE&gt;&lt;/PRE&gt;&lt;/P&gt;

&lt;P&gt;Thanks for looking into it. &lt;/P&gt;</description>
      <pubDate>Mon, 06 May 2013 11:06:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-to-pass-search-results-to-custom-JavaScript-module/m-p/25078#M746</guid>
      <dc:creator>kasu_praveen</dc:creator>
      <dc:date>2013-05-06T11:06:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass search results to custom JavaScript module</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-to-pass-search-results-to-custom-JavaScript-module/m-p/25079#M747</link>
      <description>&lt;P&gt;If you want to do something custom where you're operating on the search result rows, then I do not think you want a splunk UI module,  but rather a custom search command. &lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/5.0.2/AdvancedDev/SearchScripts"&gt;http://docs.splunk.com/Documentation/Splunk/5.0.2/AdvancedDev/SearchScripts&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;What exactly do you want to do with the results though?   If you just want to do things with field values that are on the &lt;EM&gt;first&lt;/EM&gt; row only,  then look into the documentation for the ResultsValueSetter module.  If you just want to display field values from the search results of the first &lt;EM&gt;few&lt;/EM&gt; result rows then look into the documentation for the HTML module.   Beyond these simple use cases , operating on large numbers of result rows is really not what the User Interface layer is good at and you'll want to look at writing a custom search command. &lt;/P&gt;</description>
      <pubDate>Tue, 07 May 2013 18:52:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-to-pass-search-results-to-custom-JavaScript-module/m-p/25079#M747</guid>
      <dc:creator>sideview</dc:creator>
      <dc:date>2013-05-07T18:52:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass search results to custom JavaScript module</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-to-pass-search-results-to-custom-JavaScript-module/m-p/25080#M748</link>
      <description>&lt;P&gt;@kasu_praveen - did you ever get this figured out?  I'd like to do the same thing.&lt;/P&gt;</description>
      <pubDate>Mon, 31 Mar 2014 20:33:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-to-pass-search-results-to-custom-JavaScript-module/m-p/25080#M748</guid>
      <dc:creator>redc</dc:creator>
      <dc:date>2014-03-31T20:33:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass search results to custom JavaScript module</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-to-pass-search-results-to-custom-JavaScript-module/m-p/25081#M749</link>
      <description>&lt;P&gt;&lt;STRONG&gt;My XML Code:&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;module name="Search" layoutPanel="appHeader"&amp;gt;
    &amp;lt;param name="search"&amp;gt; &amp;lt;Write your search query here&amp;gt; | table abc def ghi&amp;lt;/param&amp;gt;
    &amp;lt;module name="ResultsValueSetter"&amp;gt;
        &amp;lt;param name="fields"&amp;gt;abc,def,ghi&amp;lt;/param&amp;gt;
        &amp;lt;module name="CustomBehavior"&amp;gt;
            &amp;lt;param name="customBehavior"&amp;gt;MyCustomMethod&amp;lt;/param&amp;gt; 
        &amp;lt;/module&amp;gt;
    &amp;lt;/module&amp;gt;
&amp;lt;/module&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;MY JavaScript Code&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Sideview.utils.declareCustomBehavior("MyCustomMethod", function(MyCustomMethodList) {
        MyCustomMethodList.onContextChange = function() {
            var context = this.getContext();
            var abcValue = context.get("abc");
            var defValue = context.get("def");
            var ghiValue = context.get("ghi");
            // Write your code by utilizing above "abcValue", "defValue" and "ghiValue" values.
        }
    });
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This is working as expected. Thank you @sideview (Nick) for your suggestion.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Apr 2014 05:35:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-to-pass-search-results-to-custom-JavaScript-module/m-p/25081#M749</guid>
      <dc:creator>kasu_praveen</dc:creator>
      <dc:date>2014-04-01T05:35:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass search results to custom JavaScript module</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-to-pass-search-results-to-custom-JavaScript-module/m-p/25082#M750</link>
      <description>&lt;P&gt;@redc I have provided my answer below.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Apr 2014 05:36:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-to-pass-search-results-to-custom-JavaScript-module/m-p/25082#M750</guid>
      <dc:creator>kasu_praveen</dc:creator>
      <dc:date>2014-04-01T05:36:14Z</dc:date>
    </item>
  </channel>
</rss>

