<?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: Conditional statements/output in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Conditional-statements-output/m-p/56894#M3021</link>
    <description>&lt;P&gt;There are a few options, but a simple way is to use &lt;CODE&gt;eval&lt;/CODE&gt; to pull out a new field. &lt;/P&gt;

&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eval yesno=if(count==0, "No", "Yes")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The docs page for &lt;CODE&gt;eval&lt;/CODE&gt; has some other examples:
&lt;A href="http://www.splunk.com/base/Documentation/4.1.5/SearchReference/Eval" rel="nofollow"&gt;http://www.splunk.com/base/Documentation/4.1.5/SearchReference/Eval&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;To use it in your XML, you might do something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;module name="HiddenSearch" layoutPanel="panel_row1_col1" autoRun="True"&amp;gt;
    &amp;lt;param name="search"&amp;gt;YOUR TERMS HERE | eval yesno=if(count==0, "No", "Yes") | rangemap field=count severe=0-0 default=low&amp;lt;/param&amp;gt;
    &amp;lt;module name="SingleValue"&amp;gt;
        &amp;lt;param name="field"&amp;gt;yesno&amp;lt;/param&amp;gt;
        &amp;lt;param name="classField"&amp;gt;range&amp;lt;/param&amp;gt;
    &amp;lt;/module&amp;gt;
&amp;lt;/module&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 23 Sep 2010 23:08:10 GMT</pubDate>
    <dc:creator>southeringtonp</dc:creator>
    <dc:date>2010-09-23T23:08:10Z</dc:date>
    <item>
      <title>Conditional statements/output</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Conditional-statements-output/m-p/56893#M3020</link>
      <description>&lt;P&gt;I have a search that checks to see if a process particular process is running. Simple enough. &lt;/P&gt;

&lt;P&gt;In my dashboard, I want users to be able to see if that process is running. But rather than displaying the process, I'd like to use a "" to simply say "Yes" or "No". &lt;/P&gt;

&lt;P&gt;I know Splunk can count the number of results, but is there a way to tell the dashboard to display "Yes" if count&amp;gt;0 and "No" if count==0? &lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 23 Sep 2010 22:17:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Conditional-statements-output/m-p/56893#M3020</guid>
      <dc:creator>Branden</dc:creator>
      <dc:date>2010-09-23T22:17:19Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional statements/output</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Conditional-statements-output/m-p/56894#M3021</link>
      <description>&lt;P&gt;There are a few options, but a simple way is to use &lt;CODE&gt;eval&lt;/CODE&gt; to pull out a new field. &lt;/P&gt;

&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eval yesno=if(count==0, "No", "Yes")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The docs page for &lt;CODE&gt;eval&lt;/CODE&gt; has some other examples:
&lt;A href="http://www.splunk.com/base/Documentation/4.1.5/SearchReference/Eval" rel="nofollow"&gt;http://www.splunk.com/base/Documentation/4.1.5/SearchReference/Eval&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;To use it in your XML, you might do something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;module name="HiddenSearch" layoutPanel="panel_row1_col1" autoRun="True"&amp;gt;
    &amp;lt;param name="search"&amp;gt;YOUR TERMS HERE | eval yesno=if(count==0, "No", "Yes") | rangemap field=count severe=0-0 default=low&amp;lt;/param&amp;gt;
    &amp;lt;module name="SingleValue"&amp;gt;
        &amp;lt;param name="field"&amp;gt;yesno&amp;lt;/param&amp;gt;
        &amp;lt;param name="classField"&amp;gt;range&amp;lt;/param&amp;gt;
    &amp;lt;/module&amp;gt;
&amp;lt;/module&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 23 Sep 2010 23:08:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Conditional-statements-output/m-p/56894#M3021</guid>
      <dc:creator>southeringtonp</dc:creator>
      <dc:date>2010-09-23T23:08:10Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional statements/output</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Conditional-statements-output/m-p/56895#M3022</link>
      <description>&lt;P&gt;Thanks for the reply.&lt;BR /&gt;
Unfortunately, this doesn't seem to work in the context of a dashboard. I keep getting a "mismatched tag:" error when I had the eval statement. The same thing happens when I use a regex. In the search bar it's fine, but not in an XML file...&lt;/P&gt;</description>
      <pubDate>Fri, 24 Sep 2010 00:04:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Conditional-statements-output/m-p/56895#M3022</guid>
      <dc:creator>Branden</dc:creator>
      <dc:date>2010-09-24T00:04:55Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional statements/output</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Conditional-statements-output/m-p/56896#M3023</link>
      <description>&lt;P&gt;Actually I figured out the mis-matched tag issue... but it's still not providing the expected behavior. It's reporting "N/A". But I think you've pointed me in the right direction. I'll try to figure it out from here. Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 24 Sep 2010 00:08:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Conditional-statements-output/m-p/56896#M3023</guid>
      <dc:creator>Branden</dc:creator>
      <dc:date>2010-09-24T00:08:34Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional statements/output</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Conditional-statements-output/m-p/56897#M3024</link>
      <description>&lt;P&gt;The N/A sounds like you have a SingleValue module that's looking at the wrong field. See edits to answer above.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Sep 2010 06:16:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Conditional-statements-output/m-p/56897#M3024</guid>
      <dc:creator>southeringtonp</dc:creator>
      <dc:date>2010-09-24T06:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Conditional statements/output</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Conditional-statements-output/m-p/56898#M3025</link>
      <description>&lt;P&gt;I had to change &lt;MODULE&gt; to "&lt;MODULE name="HiddenSearch....&amp;gt; to avoid a token error at start-up. Having done that, I now get the following error:&amp;lt;br&amp;gt;
NotImplementedError: Cannot find object mapper for panel type: module&amp;lt;/p&amp;gt;

&amp;lt;p&amp;gt;It sounds like this may be more effort than it's worth, however. I can just have Splunk display the process listing. Not as pretty, but it works. :-)&amp;lt;/p&amp;gt;"&gt;&lt;/MODULE&gt;&lt;/MODULE&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Sep 2010 19:57:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Conditional-statements-output/m-p/56898#M3025</guid>
      <dc:creator>Branden</dc:creator>
      <dc:date>2010-09-24T19:57:00Z</dc:date>
    </item>
  </channel>
</rss>

