<?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: eval isnull() always returns true in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/eval-isnull-always-returns-true/m-p/101124#M182816</link>
    <description>&lt;P&gt;That's perfect thanks.&lt;/P&gt;</description>
    <pubDate>Wed, 28 Mar 2012 08:55:51 GMT</pubDate>
    <dc:creator>dmrhodes101</dc:creator>
    <dc:date>2012-03-28T08:55:51Z</dc:date>
    <item>
      <title>eval isnull() always returns true</title>
      <link>https://community.splunk.com/t5/Splunk-Search/eval-isnull-always-returns-true/m-p/101122#M182814</link>
      <description>&lt;P&gt;We're using Splunk to monitor EDI traffic onto our backend system. We want to have a single value panel that shows green when an order has been received, yellow, when there's been no order and it's prior to 16:00 and red when there's been no order and it's 16:00+&lt;/P&gt;

&lt;P&gt;Here's the command I used, but the isnull always returns 0 even when EDI-count is greater than 0. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="C:\\Monitor\\Vista\\EDI\\EDISPLUNK.csv" NOT _raw="Date,Time,Type,Account,Name,Order Qty,EAN,SAN,Order Ref,Order Date,From1,From2" host="Vista-EDI2" AND Name="Companyname*" 
| stats count as EDI-count
| eval Time=now()
| convert timeformat=%H:%M ctime(Time)
| eval Got=if(isnull(EDI-count),0,1)
| eval Test=case(Got=0 and Time&amp;gt;="16:00",0,Got=0 and Time&amp;lt;"16:00",2,Got=1,4)
| rangemap field=Test low=4-5 elevated=2-3 default=severe
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 26 Mar 2012 14:50:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/eval-isnull-always-returns-true/m-p/101122#M182814</guid>
      <dc:creator>dmrhodes101</dc:creator>
      <dc:date>2012-03-26T14:50:31Z</dc:date>
    </item>
    <item>
      <title>Re: eval isnull() always returns true</title>
      <link>https://community.splunk.com/t5/Splunk-Search/eval-isnull-always-returns-true/m-p/101123#M182815</link>
      <description>&lt;P&gt;I think that stats will give you a 0 for the count if there are no matching events, not null.  Zero isn't null.&lt;/P&gt;

&lt;P&gt;It also appears that Splunk may be interpreting the field name "EDI-count" as a subtraction of two undefined fields EDI and count.  I had to remove the - (or change it to an underscore) to make it work in my testing.&lt;/P&gt;

&lt;P&gt;The EDI_count field is effectively acting as a boolean already, but if you want to normalize it to (0|1), your eval call would look like:&lt;BR /&gt;
&lt;CODE&gt;eval Got=if(EDI_count,1,0)&lt;/CODE&gt;, or &lt;CODE&gt;eval Got=if(EDI_count==0,0,1)&lt;/CODE&gt; if you're the explicit type.&lt;/P&gt;

&lt;P&gt;Note also that you can save a step with your Time field and do &lt;CODE&gt;eval Time=strftime(now(), "%H:%M")&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Mar 2012 21:57:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/eval-isnull-always-returns-true/m-p/101123#M182815</guid>
      <dc:creator>sowings</dc:creator>
      <dc:date>2012-03-27T21:57:14Z</dc:date>
    </item>
    <item>
      <title>Re: eval isnull() always returns true</title>
      <link>https://community.splunk.com/t5/Splunk-Search/eval-isnull-always-returns-true/m-p/101124#M182816</link>
      <description>&lt;P&gt;That's perfect thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Mar 2012 08:55:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/eval-isnull-always-returns-true/m-p/101124#M182816</guid>
      <dc:creator>dmrhodes101</dc:creator>
      <dc:date>2012-03-28T08:55:51Z</dc:date>
    </item>
    <item>
      <title>Re: eval isnull() always returns true</title>
      <link>https://community.splunk.com/t5/Splunk-Search/eval-isnull-always-returns-true/m-p/704915#M238760</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/119048"&gt;@dmrhodes101&lt;/a&gt;&amp;nbsp;, it looks like you are trying to process EDI, we do have a solution accelerator for processing EDIs, love to share some of the content we have.&amp;nbsp; Let me know if you're interested.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Nov 2024 08:14:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/eval-isnull-always-returns-true/m-p/704915#M238760</guid>
      <dc:creator>youngc_splunk</dc:creator>
      <dc:date>2024-11-21T08:14:56Z</dc:date>
    </item>
  </channel>
</rss>

