<?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: Search event handler not being executed... in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Search-event-handler-not-being-executed/m-p/320288#M20631</link>
    <description>&lt;P&gt;I've tried , , even &lt;BR /&gt;
I've tried using $job.resultCount$ and 'job.resultCount'&lt;BR /&gt;
None are working.&lt;/P&gt;</description>
    <pubDate>Tue, 31 Oct 2017 13:17:53 GMT</pubDate>
    <dc:creator>lyndac</dc:creator>
    <dc:date>2017-10-31T13:17:53Z</dc:date>
    <item>
      <title>Search event handler not being executed...</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Search-event-handler-not-being-executed/m-p/320281#M20624</link>
      <description>&lt;P&gt;I am using Splunk Enterprise 6.4.7.&lt;/P&gt;

&lt;P&gt;Created a dashboard panel.  I want to include the number of results in the panel title.  I'm trying to use the job.resultCount token in the  event handler.  I've also tried to use &lt;/P&gt;

&lt;P&gt;This is my panel:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;table&amp;gt;
        &amp;lt;title&amp;gt;$numSrchResults$ Results Returned&amp;lt;/title&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;index=foo | table _time, name, bar, foobar&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;$timer_tok.earliest$&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;$timer_tok.latest$&amp;lt;/latest&amp;gt;
          &amp;lt;done&amp;gt;
              &amp;lt;condition&amp;gt;
                 &amp;lt;eval token="numSrchResults"&amp;gt;'job.resultCount'&amp;lt;/eval&amp;gt;
              &amp;lt;/condition&amp;gt;
          &amp;lt;/done&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="rowNumbers"&amp;gt;true&amp;lt;/option&amp;gt;
        &amp;lt;option name="drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
      &amp;lt;/table&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;My search returns about 35 results in the table.  However, the token &lt;CODE&gt;$numSrchResults$&lt;/CODE&gt; never gets set.  I've tried several different things:  &lt;CODE&gt;$job.resultCount$&lt;/CODE&gt;,  &lt;CODE&gt;'job.resultCount'&lt;/CODE&gt;,  using &lt;CODE&gt;&amp;lt;set&amp;gt;&amp;lt;/set&amp;gt;&lt;/CODE&gt;  instead of &lt;CODE&gt;&amp;lt;eval&amp;gt;&amp;lt;/eval&amp;gt;&lt;/CODE&gt;, specifying a match condition, using finalize instead of done.  None of these work.  Any ideas?&lt;/P&gt;</description>
      <pubDate>Fri, 20 Oct 2017 18:29:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Search-event-handler-not-being-executed/m-p/320281#M20624</guid>
      <dc:creator>lyndac</dc:creator>
      <dc:date>2017-10-20T18:29:55Z</dc:date>
    </item>
    <item>
      <title>Re: Search event handler not being executed...</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Search-event-handler-not-being-executed/m-p/320282#M20625</link>
      <description>&lt;P&gt;Hi lyndac,&lt;BR /&gt;
in my dashboard I always use to put between search tags:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;progress&amp;gt;
     &amp;lt;set token="my_token"&amp;gt;$job.resultCount$&amp;lt;/set&amp;gt;
&amp;lt;/progress&amp;gt;
&amp;lt;cancelled&amp;gt;
     &amp;lt;unset token="my_token"&amp;gt;&amp;lt;/unset&amp;gt;
&amp;lt;/cancelled&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;an it runs!&lt;/P&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Sat, 21 Oct 2017 09:05:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Search-event-handler-not-being-executed/m-p/320282#M20625</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2017-10-21T09:05:25Z</dc:date>
    </item>
    <item>
      <title>Re: Search event handler not being executed...</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Search-event-handler-not-being-executed/m-p/320283#M20626</link>
      <description>&lt;P&gt;Hi lyndac,&lt;/P&gt;

&lt;P&gt;You can use &lt;CODE&gt;$job.resultPreviewCount$&lt;/CODE&gt; for preview count.&lt;/P&gt;

&lt;P&gt;Can you please try below XML??&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form&amp;gt;
  &amp;lt;fieldset submitButton="false"&amp;gt;
    &amp;lt;input type="time" token="timer_tok"&amp;gt;
      &amp;lt;label&amp;gt;&amp;lt;/label&amp;gt;
      &amp;lt;default&amp;gt;
        &amp;lt;earliest&amp;gt;-24h@h&amp;lt;/earliest&amp;gt;
        &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
      &amp;lt;/default&amp;gt;
    &amp;lt;/input&amp;gt;
  &amp;lt;/fieldset&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;table&amp;gt;
        &amp;lt;title&amp;gt;$numSrchResults$ Results Returned&amp;lt;/title&amp;gt;
        &amp;lt;search&amp;gt;
           &amp;lt;query&amp;gt;index=foo | table _time, name, bar, foobar&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;$timer_tok.earliest$&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;$timer_tok.latest$&amp;lt;/latest&amp;gt;
          &amp;lt;progress&amp;gt;
              &amp;lt;set token="numSrchResults"&amp;gt;$job.resultPreviewCount$&amp;lt;/set&amp;gt;
          &amp;lt;/progress&amp;gt;
          &amp;lt;cancelled&amp;gt;
              &amp;lt;unset token="numSrchResults"&amp;gt;&amp;lt;/unset&amp;gt;
          &amp;lt;/cancelled&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="refresh.display"&amp;gt;progressbar&amp;lt;/option&amp;gt;
        &amp;lt;option name="rowNumbers"&amp;gt;true&amp;lt;/option&amp;gt;
      &amp;lt;/table&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 24 Oct 2017 12:41:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Search-event-handler-not-being-executed/m-p/320283#M20626</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2017-10-24T12:41:16Z</dc:date>
    </item>
    <item>
      <title>Re: Search event handler not being executed...</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Search-event-handler-not-being-executed/m-p/320284#M20627</link>
      <description>&lt;P&gt;I tried this and still do not get the result count displayed.  My code was working when using version 6.4.3, but when we upgraded to 6.4.7, it stopped working.  When I look at the generated HTML in the debugger, I do not see a function that would handle the search event.  It's like the SimpleXML is not being correctly translated to HTML&lt;/P&gt;</description>
      <pubDate>Mon, 30 Oct 2017 18:09:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Search-event-handler-not-being-executed/m-p/320284#M20627</guid>
      <dc:creator>lyndac</dc:creator>
      <dc:date>2017-10-30T18:09:06Z</dc:date>
    </item>
    <item>
      <title>Re: Search event handler not being executed...</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Search-event-handler-not-being-executed/m-p/320285#M20628</link>
      <description>&lt;P&gt;Hi&lt;BR /&gt;
Can you please share full XML ( hide original search and confidential values) ??&lt;/P&gt;</description>
      <pubDate>Tue, 31 Oct 2017 02:43:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Search-event-handler-not-being-executed/m-p/320285#M20628</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2017-10-31T02:43:20Z</dc:date>
    </item>
    <item>
      <title>Re: Search event handler not being executed...</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Search-event-handler-not-being-executed/m-p/320286#M20629</link>
      <description>&lt;P&gt;Full XML is below.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;   &amp;lt;form&amp;gt;
      &amp;lt;fieldset submitButton="false"&amp;gt;
           &amp;lt;input type="time" token="timer_tok"&amp;gt;
              &amp;lt;default&amp;gt;
                  &amp;lt;earliest&amp;gt;@d&amp;lt;/earliest&amp;gt;
                  &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
              &amp;lt;/default&amp;gt;
           &amp;lt;/input&amp;gt;
       &amp;lt;/fieldset&amp;gt;
       &amp;lt;row&amp;gt;
         &amp;lt;panel&amp;gt;
           &amp;lt;table&amp;gt;
             &amp;lt;title&amp;gt;$numSrchResults$ Results Returned&amp;lt;/title&amp;gt;
             &amp;lt;search&amp;gt;
               &amp;lt;query&amp;gt;index=foo | table _time, name, bar, foobar&amp;lt;/query&amp;gt;
               &amp;lt;earliest&amp;gt;$timer_tok.earliest$&amp;lt;/earliest&amp;gt;
               &amp;lt;latest&amp;gt;$timer_tok.latest$&amp;lt;/latest&amp;gt;
               &amp;lt;done&amp;gt;
                      &amp;lt;set token="numSrchResults"&amp;gt;$job.resultCount$&amp;lt;/set&amp;gt;
               &amp;lt;/done&amp;gt;
             &amp;lt;/search&amp;gt;
             &amp;lt;option name="rowNumbers"&amp;gt;true&amp;lt;/option&amp;gt;
             &amp;lt;option name="drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
           &amp;lt;/table&amp;gt;
         &amp;lt;/panel&amp;gt;
       &amp;lt;/row&amp;gt;
     &amp;lt;/form&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;FWIW -- I converted the dashboard to HTML and added code to handle the done event, and that works.  However, I should NOT have to convert to HTML just for that work.  This is the code that I had to add:&lt;/P&gt;

&lt;P&gt;search1.on("search:done", function(properties) {&lt;BR /&gt;
    setToken("numresults", properties.content.resultCount);&lt;BR /&gt;
});&lt;/P&gt;</description>
      <pubDate>Tue, 31 Oct 2017 12:22:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Search-event-handler-not-being-executed/m-p/320286#M20629</guid>
      <dc:creator>lyndac</dc:creator>
      <dc:date>2017-10-31T12:22:24Z</dc:date>
    </item>
    <item>
      <title>Re: Search event handler not being executed...</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Search-event-handler-not-being-executed/m-p/320287#M20630</link>
      <description>&lt;P&gt;@lyndac the search event handlers to access job tokens and results tokens were changed to&lt;CODE&gt;&amp;lt;progress&amp;gt;&lt;/CODE&gt; and &lt;CODE&gt;&amp;lt;done&amp;gt;&lt;/CODE&gt; from Splunk Enterprise 6.5 onward. Till version 6.4 they were &lt;CODE&gt;&amp;lt;preview&amp;gt;&lt;/CODE&gt; and &lt;CODE&gt;&amp;lt;finalized&amp;gt;&lt;/CODE&gt;. Try your dashboard with &lt;CODE&gt;&amp;lt;finalized&amp;gt;&lt;/CODE&gt; instead of &lt;CODE&gt;&amp;lt;done&amp;gt;&lt;/CODE&gt; and hopefully it should work. &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.4.7/Viz/EventHandlerReference#finalized"&gt;http://docs.splunk.com/Documentation/Splunk/6.4.7/Viz/EventHandlerReference#finalized&lt;/A&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; &amp;lt;finalized&amp;gt;
     &amp;lt;set token="numSrchResults"&amp;gt;$job.resultCount$&amp;lt;/set&amp;gt;
 &amp;lt;/finalized&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Please try out and confirm. &lt;/P&gt;

&lt;P&gt;PS: &lt;CODE&gt;&amp;lt;preview&amp;gt;&lt;/CODE&gt; and &lt;CODE&gt;&amp;lt;finalized&amp;gt;&lt;/CODE&gt; have been removed since 6.5. So, you will have to reconsider moving back to &lt;CODE&gt;&amp;lt;progress&amp;gt;&lt;/CODE&gt; or &lt;CODE&gt;&amp;lt;done&amp;gt;&lt;/CODE&gt; when you plan your next upgrade.&lt;/P&gt;</description>
      <pubDate>Tue, 31 Oct 2017 12:45:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Search-event-handler-not-being-executed/m-p/320287#M20630</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-10-31T12:45:13Z</dc:date>
    </item>
    <item>
      <title>Re: Search event handler not being executed...</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Search-event-handler-not-being-executed/m-p/320288#M20631</link>
      <description>&lt;P&gt;I've tried , , even &lt;BR /&gt;
I've tried using $job.resultCount$ and 'job.resultCount'&lt;BR /&gt;
None are working.&lt;/P&gt;</description>
      <pubDate>Tue, 31 Oct 2017 13:17:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Search-event-handler-not-being-executed/m-p/320288#M20631</guid>
      <dc:creator>lyndac</dc:creator>
      <dc:date>2017-10-31T13:17:53Z</dc:date>
    </item>
    <item>
      <title>Re: Search event handler not being executed...</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Search-event-handler-not-being-executed/m-p/320289#M20632</link>
      <description>&lt;P&gt;Or just to test whether our event handlers are being invoked... It should hit one of the conditions either default to 0 or show some value (may be null in your case if it does not work &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt; )&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  &amp;lt;finalized&amp;gt;
      &amp;lt;condition match="$job.resultCount$==0"&amp;gt;
           &amp;lt;set token="numSrchResults"&amp;gt;0&amp;lt;/set&amp;gt;
      &amp;lt;/condition&amp;gt;
      &amp;lt;condition&amp;gt;
           &amp;lt;set token="numSrchResults"&amp;gt;$job.resultCount$&amp;lt;/set&amp;gt;
      &amp;lt;/condition&amp;gt;
  &amp;lt;/finalized&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Try something similar with &lt;CODE&gt;&amp;lt;preview&amp;gt;&lt;/CODE&gt; instead of &lt;CODE&gt;&amp;lt;finalized&amp;gt;&lt;/CODE&gt;&lt;BR /&gt;
So many hit and trials would be frustrating so it is better you open up a support case with Splunk to have them look at the issues you are facing. Ideally this should have worked.&lt;/P&gt;</description>
      <pubDate>Tue, 31 Oct 2017 17:32:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Search-event-handler-not-being-executed/m-p/320289#M20632</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-10-31T17:32:36Z</dc:date>
    </item>
    <item>
      <title>Re: Search event handler not being executed...</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Search-event-handler-not-being-executed/m-p/320290#M20633</link>
      <description>&lt;P&gt;Hi&lt;BR /&gt;
Does it work for you?&lt;/P&gt;</description>
      <pubDate>Sat, 04 Nov 2017 17:14:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Search-event-handler-not-being-executed/m-p/320290#M20633</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2017-11-04T17:14:14Z</dc:date>
    </item>
  </channel>
</rss>

