<?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 with the same search conditions, I cannot make eval if function to return true... in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/with-the-same-search-conditions-I-cannot-make-eval-if-function/m-p/367118#M161167</link>
    <description>&lt;P&gt;For some use case, I need to make a new true/false field.&lt;/P&gt;

&lt;P&gt;Below condition returns 11 events in my data sample:&lt;BR /&gt;
    | from datamodel:"SomeDataModel.SomeDataSet" |search LocalField1=ABC AND CalculatedField2!=0&lt;/P&gt;

&lt;P&gt;But if I write it with Eval and if functions like below, it returns no event:&lt;BR /&gt;
    | from datamodel:"SomeDataModel.SomeDataSet" |eval truefalseField1=if((LocalField1=ABC AND CalculatedField2!=0),true,false) &lt;BR /&gt;
    |search truefalseField1=true&lt;/P&gt;

&lt;P&gt;How can I make the 2nd search also return same (11) events? Could you please help?&lt;/P&gt;

&lt;P&gt;Thanks.&lt;/P&gt;</description>
    <pubDate>Mon, 08 May 2017 12:08:25 GMT</pubDate>
    <dc:creator>leonjxtan</dc:creator>
    <dc:date>2017-05-08T12:08:25Z</dc:date>
    <item>
      <title>with the same search conditions, I cannot make eval if function to return true...</title>
      <link>https://community.splunk.com/t5/Splunk-Search/with-the-same-search-conditions-I-cannot-make-eval-if-function/m-p/367118#M161167</link>
      <description>&lt;P&gt;For some use case, I need to make a new true/false field.&lt;/P&gt;

&lt;P&gt;Below condition returns 11 events in my data sample:&lt;BR /&gt;
    | from datamodel:"SomeDataModel.SomeDataSet" |search LocalField1=ABC AND CalculatedField2!=0&lt;/P&gt;

&lt;P&gt;But if I write it with Eval and if functions like below, it returns no event:&lt;BR /&gt;
    | from datamodel:"SomeDataModel.SomeDataSet" |eval truefalseField1=if((LocalField1=ABC AND CalculatedField2!=0),true,false) &lt;BR /&gt;
    |search truefalseField1=true&lt;/P&gt;

&lt;P&gt;How can I make the 2nd search also return same (11) events? Could you please help?&lt;/P&gt;

&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 08 May 2017 12:08:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/with-the-same-search-conditions-I-cannot-make-eval-if-function/m-p/367118#M161167</guid>
      <dc:creator>leonjxtan</dc:creator>
      <dc:date>2017-05-08T12:08:25Z</dc:date>
    </item>
    <item>
      <title>Re: with the same search conditions, I cannot make eval if function to return true...</title>
      <link>https://community.splunk.com/t5/Splunk-Search/with-the-same-search-conditions-I-cannot-make-eval-if-function/m-p/367119#M161168</link>
      <description>&lt;P&gt;this is actually splunk-enterprise question, but after I click the Splunk Enterprise button and then click the “Post Your Question” button, it gives me error: The following topics are not present in the system, and you don't have permissions to create new ones: splunk-enterprise&lt;/P&gt;</description>
      <pubDate>Mon, 08 May 2017 12:09:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/with-the-same-search-conditions-I-cannot-make-eval-if-function/m-p/367119#M161168</guid>
      <dc:creator>leonjxtan</dc:creator>
      <dc:date>2017-05-08T12:09:53Z</dc:date>
    </item>
    <item>
      <title>Re: with the same search conditions, I cannot make eval if function to return true...</title>
      <link>https://community.splunk.com/t5/Splunk-Search/with-the-same-search-conditions-I-cannot-make-eval-if-function/m-p/367120#M161169</link>
      <description>&lt;P&gt;The values &lt;CODE&gt;true&lt;/CODE&gt; and &lt;CODE&gt;false&lt;/CODE&gt; are not recognized values. You have to use either the strings values "true" and "false" or use numbers &lt;CODE&gt;1&lt;/CODE&gt; and &lt;CODE&gt;0&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;For example&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;| from datamodel:"SomeDataModel.SomeDataSet" |eval truefalseField1=if((LocalField1=ABC AND CalculatedField2!=0),1,0) | search truefalseField1=1&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 08 May 2017 12:12:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/with-the-same-search-conditions-I-cannot-make-eval-if-function/m-p/367120#M161169</guid>
      <dc:creator>rjthibod</dc:creator>
      <dc:date>2017-05-08T12:12:56Z</dc:date>
    </item>
    <item>
      <title>Re: with the same search conditions, I cannot make eval if function to return true...</title>
      <link>https://community.splunk.com/t5/Splunk-Search/with-the-same-search-conditions-I-cannot-make-eval-if-function/m-p/367121#M161170</link>
      <description>&lt;P&gt;have you tried putting everything in quotations that isn't a number? &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| from datamodel:"SomeDataModel.SomeDataSet" |eval truefalseField1=if((LocalField1="ABC" AND CalculatedField2!=0),"true","false") 
|search truefalseField1="true"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 08 May 2017 12:13:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/with-the-same-search-conditions-I-cannot-make-eval-if-function/m-p/367121#M161170</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2017-05-08T12:13:13Z</dc:date>
    </item>
    <item>
      <title>Re: with the same search conditions, I cannot make eval if function to return true...</title>
      <link>https://community.splunk.com/t5/Splunk-Search/with-the-same-search-conditions-I-cannot-make-eval-if-function/m-p/367122#M161171</link>
      <description>&lt;P&gt;found reason why. It is that only when in eval statement, the CalculatedField2 failed to return any value. but in the first statement, the calculated field worked fine.&lt;/P&gt;</description>
      <pubDate>Tue, 09 May 2017 01:46:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/with-the-same-search-conditions-I-cannot-make-eval-if-function/m-p/367122#M161171</guid>
      <dc:creator>leonjxtan</dc:creator>
      <dc:date>2017-05-09T01:46:10Z</dc:date>
    </item>
  </channel>
</rss>

