<?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: Why is my &amp;quot;eval field=if()&amp;quot; search returning TRUE or FALSE instead of a numeric value? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-quot-eval-field-if-quot-search-returning-TRUE-or-FALSE/m-p/260614#M78181</link>
    <description>&lt;P&gt;I've just deleted my answer as @richgalloway already provided you with a valid one&lt;/P&gt;</description>
    <pubDate>Tue, 02 Feb 2016 13:32:19 GMT</pubDate>
    <dc:creator>javiergn</dc:creator>
    <dc:date>2016-02-02T13:32:19Z</dc:date>
    <item>
      <title>Why is my "eval field=if()" search returning TRUE or FALSE instead of a numeric value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-quot-eval-field-if-quot-search-returning-TRUE-or-FALSE/m-p/260611#M78178</link>
      <description>&lt;P&gt;Hi. &lt;/P&gt;

&lt;P&gt;I am trying to search across multiple indexes. The field I am looking for is &lt;STRONG&gt;Value&lt;/STRONG&gt; (and has only numbers). This value must not contain any decimals, and in case the sourcetype is sourcetype1, then the value must be recalculated as &lt;CODE&gt;(Value-100)*-1&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;My search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=*  sourcetype="sourcetype1" OR source=source2 | eval Value=if(sourcetype="sourcetype1", Value=round(((Value-100)*-1), 0), Value=round(Value, 0))
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The result I get is either True or False for the Value field. What am I doing wrong?&lt;/P&gt;

&lt;P&gt;Thank you in advance.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Feb 2016 13:09:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-quot-eval-field-if-quot-search-returning-TRUE-or-FALSE/m-p/260611#M78178</guid>
      <dc:creator>andrei1bc</dc:creator>
      <dc:date>2016-02-02T13:09:17Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my "eval field=if()" search returning TRUE or FALSE instead of a numeric value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-quot-eval-field-if-quot-search-returning-TRUE-or-FALSE/m-p/260612#M78179</link>
      <description>&lt;UL&gt;
&lt;LI&gt;forgot to mention that there is no event in any index that has the sourcetype=sourcetype1 and source=source2 &lt;/LI&gt;
&lt;LI&gt;sourcetype=sourcetype1 events are stored in index1&lt;/LI&gt;
&lt;LI&gt;source=source2 events are stored in index2&lt;/LI&gt;
&lt;LI&gt;searching by value and applying the same type of condition returns me the same TRUE / FALSE results&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Tue, 02 Feb 2016 13:23:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-quot-eval-field-if-quot-search-returning-TRUE-or-FALSE/m-p/260612#M78179</guid>
      <dc:creator>andrei1bc</dc:creator>
      <dc:date>2016-02-02T13:23:32Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my "eval field=if()" search returning TRUE or FALSE instead of a numeric value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-quot-eval-field-if-quot-search-returning-TRUE-or-FALSE/m-p/260613#M78180</link>
      <description>&lt;P&gt;Your &lt;CODE&gt;if&lt;/CODE&gt; command is returning comparisons instead of values.  Try &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index= sourcetype="sourcetype1" OR source=source2 | eval Value=if(sourcetype="sourcetype1", round(((Value-100)-1), 0), round(Value, 0))
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 02 Feb 2016 13:24:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-quot-eval-field-if-quot-search-returning-TRUE-or-FALSE/m-p/260613#M78180</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2016-02-02T13:24:25Z</dc:date>
    </item>
    <item>
      <title>Re: Why is my "eval field=if()" search returning TRUE or FALSE instead of a numeric value?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-is-my-quot-eval-field-if-quot-search-returning-TRUE-or-FALSE/m-p/260614#M78181</link>
      <description>&lt;P&gt;I've just deleted my answer as @richgalloway already provided you with a valid one&lt;/P&gt;</description>
      <pubDate>Tue, 02 Feb 2016 13:32:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-is-my-quot-eval-field-if-quot-search-returning-TRUE-or-FALSE/m-p/260614#M78181</guid>
      <dc:creator>javiergn</dc:creator>
      <dc:date>2016-02-02T13:32:19Z</dc:date>
    </item>
  </channel>
</rss>

