<?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: Trying to return an event based on an eval if statement, why am I getting &amp;quot;Typechecking failed. The '==' operator received different types.&amp;quot;? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Trying-to-return-an-event-based-on-an-eval-if-statement-why-am-I/m-p/262543#M78820</link>
    <description>&lt;P&gt;Thanks it worked like a charm.&lt;/P&gt;</description>
    <pubDate>Tue, 24 May 2016 15:05:53 GMT</pubDate>
    <dc:creator>maximus_reborn</dc:creator>
    <dc:date>2016-05-24T15:05:53Z</dc:date>
    <item>
      <title>Trying to return an event based on an eval if statement, why am I getting "Typechecking failed. The '==' operator received different types."?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trying-to-return-an-event-based-on-an-eval-if-statement-why-am-I/m-p/262538#M78815</link>
      <description>&lt;P&gt;I am calculating distance between the 2 latitude and longitude and if the distance &amp;gt; 0, then it will return the event or else it does not do anything. An event contains a Json message body. Following is the search I am using, but it is giving me an error.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=SplunkRabbitMQ_messaging | spath input=msg_body | eval distance=sqrt(pow('13'-[search sourcetype=SplunkKafka_messaging | spath input=msg_body | eval lat2=pickup_latitude | return $lat2],2)+pow('5'-[search sourcetype=SplunkKafka_messaging | spath input=msg_body | eval long2=pickup_longitude | return $long2],2)) | eval result = if (distance&amp;gt;0, [search sourcetype=SplunkRabbitMQ_messaging | spath input=msg_body], [search sourcetype=SplunkKafka_messaging | spath input=msg_body]) | return $result
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Error:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Error in 'eval' command: Typechecking failed. The '==' operator received different types.
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I have to use this search in real-time.&lt;BR /&gt;
&lt;STRONG&gt;Update:&lt;/STRONG&gt; In the search , '13' &amp;amp; '5' are the column indexes and not the numeric value.&lt;/P&gt;</description>
      <pubDate>Tue, 24 May 2016 09:47:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trying-to-return-an-event-based-on-an-eval-if-statement-why-am-I/m-p/262538#M78815</guid>
      <dc:creator>maximus_reborn</dc:creator>
      <dc:date>2016-05-24T09:47:55Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to return an event based on an eval if statement, why am I getting "Typechecking failed. The '==' operator received different types."?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trying-to-return-an-event-based-on-an-eval-if-statement-why-am-I/m-p/262539#M78816</link>
      <description>&lt;P&gt;You're putting integers in single quotes which is declaring them as strings, then you're trying math on strings.  Do this instead:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=SplunkRabbitMQ_messaging | spath input=msg_body | eval distance=sqrt(pow(13-[search sourcetype=SplunkKafka_messaging | spath input=msg_body | eval lat2=pickup_latitude | return $lat2],2)+pow(5-[search sourcetype=SplunkKafka_messaging | spath input=msg_body | eval long2=pickup_longitude | return $long2],2)) | eval result = if (distance&amp;gt;0, [search sourcetype=SplunkRabbitMQ_messaging | spath input=msg_body], [search sourcetype=SplunkKafka_messaging | spath input=msg_body]) | return $result
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 24 May 2016 12:56:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trying-to-return-an-event-based-on-an-eval-if-statement-why-am-I/m-p/262539#M78816</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2016-05-24T12:56:25Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to return an event based on an eval if statement, why am I getting "Typechecking failed. The '==' operator received different types."?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trying-to-return-an-event-based-on-an-eval-if-statement-why-am-I/m-p/262540#M78817</link>
      <description>&lt;P&gt;Run your search before the eval result and table distance.  I suspect you are getting a value that is not a number.&lt;/P&gt;

&lt;P&gt;You might also consider downloading the haversign app to do the calculation for you:&lt;/P&gt;

&lt;P&gt;&lt;A href="https://splunkbase.splunk.com/app/936/"&gt;https://splunkbase.splunk.com/app/936/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 24 May 2016 13:05:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trying-to-return-an-event-based-on-an-eval-if-statement-why-am-I/m-p/262540#M78817</guid>
      <dc:creator>sjohnson_splunk</dc:creator>
      <dc:date>2016-05-24T13:05:19Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to return an event based on an eval if statement, why am I getting "Typechecking failed. The '==' operator received different types."?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trying-to-return-an-event-based-on-an-eval-if-statement-why-am-I/m-p/262541#M78818</link>
      <description>&lt;P&gt;Sorry I have updated the question. '13' &amp;amp; '5' were the column indexes of sourcetype=SplunkRabbitMQ_messaging, i was referring. &lt;BR /&gt;
Though I ran your query and it resulted in the same error.&lt;/P&gt;</description>
      <pubDate>Tue, 24 May 2016 13:44:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trying-to-return-an-event-based-on-an-eval-if-statement-why-am-I/m-p/262541#M78818</guid>
      <dc:creator>maximus_reborn</dc:creator>
      <dc:date>2016-05-24T13:44:28Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to return an event based on an eval if statement, why am I getting "Typechecking failed. The '==' operator received different types."?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trying-to-return-an-event-based-on-an-eval-if-statement-why-am-I/m-p/262542#M78819</link>
      <description>&lt;P&gt;I'll give this a shot&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[search sourcetype=SplunkRabbitMQ_messaging | spath input=msg_body | eval distance=sqrt(pow('13'-[search sourcetype=SplunkKafka_messaging | spath input=msg_body | eval lat2=pickup_latitude | return $lat2],2)+pow('5'-[search sourcetype=SplunkKafka_messaging | spath input=msg_body | eval long2=pickup_longitude | return $long2],2)) | eval sourcetype=if (distance&amp;gt;0, "SplunkRabbitMQ_messaging", "SplunkKafka_messaging") | table sourcetype] 
| spath input=msg_body
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The subsearch (all line except last line) will return which sourcetype to use.&lt;/P&gt;</description>
      <pubDate>Tue, 24 May 2016 14:41:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trying-to-return-an-event-based-on-an-eval-if-statement-why-am-I/m-p/262542#M78819</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-05-24T14:41:28Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to return an event based on an eval if statement, why am I getting "Typechecking failed. The '==' operator received different types."?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trying-to-return-an-event-based-on-an-eval-if-statement-why-am-I/m-p/262543#M78820</link>
      <description>&lt;P&gt;Thanks it worked like a charm.&lt;/P&gt;</description>
      <pubDate>Tue, 24 May 2016 15:05:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trying-to-return-an-event-based-on-an-eval-if-statement-why-am-I/m-p/262543#M78820</guid>
      <dc:creator>maximus_reborn</dc:creator>
      <dc:date>2016-05-24T15:05:53Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to return an event based on an eval if statement, why am I getting "Typechecking failed. The '==' operator received different types."?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trying-to-return-an-event-based-on-an-eval-if-statement-why-am-I/m-p/262544#M78821</link>
      <description>&lt;P&gt;Thanks I will have a look on it.&lt;/P&gt;</description>
      <pubDate>Wed, 25 May 2016 05:26:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trying-to-return-an-event-based-on-an-eval-if-statement-why-am-I/m-p/262544#M78821</guid>
      <dc:creator>maximus_reborn</dc:creator>
      <dc:date>2016-05-25T05:26:30Z</dc:date>
    </item>
  </channel>
</rss>

