<?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 used with stats command returns 1/0 instead of true/false in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/eval-used-with-stats-command-returns-1-0-instead-of-true-false/m-p/547598#M155289</link>
    <description>&lt;P&gt;&lt;SPAN&gt;True but it does not mention anywhere that it will be 1/0.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, it just says that we cannot have&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;`eval some_field = (name=="some_value")`&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;but we can have `count(eval(name=="some_value"))`&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is not logical conclusion from - "&lt;/SPAN&gt;&lt;SPAN&gt;The result of an eval expression cannot be a Boolean."&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 12 Apr 2021 11:50:55 GMT</pubDate>
    <dc:creator>splunkuser1948</dc:creator>
    <dc:date>2021-04-12T11:50:55Z</dc:date>
    <item>
      <title>eval used with stats command returns 1/0 instead of true/false</title>
      <link>https://community.splunk.com/t5/Splunk-Search/eval-used-with-stats-command-returns-1-0-instead-of-true-false/m-p/547577#M155279</link>
      <description>&lt;P&gt;According to the &lt;A href="https://docs.splunk.com/Documentation/SplunkCloud/8.1.2101/Search/Usestatswithevalexpressionsandfunctions" target="_self"&gt;splunk doc&lt;/A&gt;&amp;nbsp;, eval can be used within aggregate functions with stats command like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=main sourcetype="access_combined_wcookie"| stats count(eval(action = "purchase")) AS "Total purchases"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now, I was of opinion that eval is used to create a search result field and looking at the query , it seems&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;eval(action = "purchase")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;will create a field with true/false as value. But this is not the case. It actually creates a search field with value 1/0 which the count() function then counts.&lt;/P&gt;&lt;P&gt;This I did not found documented anywhere in &lt;A href="https://docs.splunk.com/Documentation/Splunk/8.1.3/SearchReference/Eval" target="_self"&gt;eval splunk docs.&lt;/A&gt; Can some one help me point to resource where all such deviations for eval command from its normal behaviour are documented ? Are there more than this ?&lt;/P&gt;</description>
      <pubDate>Mon, 12 Apr 2021 10:13:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/eval-used-with-stats-command-returns-1-0-instead-of-true-false/m-p/547577#M155279</guid>
      <dc:creator>splunkuser1948</dc:creator>
      <dc:date>2021-04-12T10:13:34Z</dc:date>
    </item>
    <item>
      <title>Re: eval used with stats command returns 1/0 instead of true/false</title>
      <link>https://community.splunk.com/t5/Splunk-Search/eval-used-with-stats-command-returns-1-0-instead-of-true-false/m-p/547592#M155286</link>
      <description>&lt;P&gt;In that link to the eval docs is the answer - see syntax/required arguments/expression it says&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;SPAN&gt;The result of an eval expression cannot be a Boolean.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;It's normal behaviour is never to create a true/false field assignment.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Apr 2021 11:25:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/eval-used-with-stats-command-returns-1-0-instead-of-true-false/m-p/547592#M155286</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2021-04-12T11:25:16Z</dc:date>
    </item>
    <item>
      <title>Re: eval used with stats command returns 1/0 instead of true/false</title>
      <link>https://community.splunk.com/t5/Splunk-Search/eval-used-with-stats-command-returns-1-0-instead-of-true-false/m-p/547598#M155289</link>
      <description>&lt;P&gt;&lt;SPAN&gt;True but it does not mention anywhere that it will be 1/0.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, it just says that we cannot have&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;`eval some_field = (name=="some_value")`&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;but we can have `count(eval(name=="some_value"))`&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is not logical conclusion from - "&lt;/SPAN&gt;&lt;SPAN&gt;The result of an eval expression cannot be a Boolean."&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Apr 2021 11:50:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/eval-used-with-stats-command-returns-1-0-instead-of-true-false/m-p/547598#M155289</guid>
      <dc:creator>splunkuser1948</dc:creator>
      <dc:date>2021-04-12T11:50:55Z</dc:date>
    </item>
  </channel>
</rss>

