<?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: If statement with multiple tests? in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/If-statement-with-multiple-tests/m-p/31301#M366</link>
    <description>&lt;P&gt;Please comment when voting down an answer.  My answer is perfectly valid.&lt;/P&gt;</description>
    <pubDate>Tue, 25 Jan 2011 14:23:03 GMT</pubDate>
    <dc:creator>araitz</dc:creator>
    <dc:date>2011-01-25T14:23:03Z</dc:date>
    <item>
      <title>If statement with multiple tests?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/If-statement-with-multiple-tests/m-p/31298#M363</link>
      <description>&lt;P&gt;Is it possible to do something like this? It would make my life a whole lot easier if this can be done, or at least something like it...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;eval if(((TimeTaken&amp;gt;15) AND ((Termination_Cause=="016") OR (Termination_Cause=="017"))),1,0)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;When I try it I get an error stating that the expression is malformed. Any advice is appreciated.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jan 2011 08:49:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/If-statement-with-multiple-tests/m-p/31298#M363</guid>
      <dc:creator>msarro</dc:creator>
      <dc:date>2011-01-25T08:49:41Z</dc:date>
    </item>
    <item>
      <title>Re: If statement with multiple tests?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/If-statement-with-multiple-tests/m-p/31299#M364</link>
      <description>&lt;P&gt;You're not far off
&lt;BR /&gt;
&lt;BR /&gt;
eval &lt;B&gt;foo=&lt;/B&gt;if((TimeTaken&amp;gt;15) AND (Termination_Cause=="016" OR Termination_Cause=="017"),1,0)&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jan 2011 09:03:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/If-statement-with-multiple-tests/m-p/31299#M364</guid>
      <dc:creator>ayme</dc:creator>
      <dc:date>2011-01-25T09:03:32Z</dc:date>
    </item>
    <item>
      <title>Re: If statement with multiple tests?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/If-statement-with-multiple-tests/m-p/31300#M365</link>
      <description>&lt;P&gt;You should probably post your whole search, there are might be some extra parenthesis in there.&lt;/P&gt;

&lt;P&gt;Note that eval takes the form:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;eval &amp;lt;my_field&amp;gt; = &amp;lt;my_eval_expression&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Also, I think you can use searchmatch() here more efficiently:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;eval case=searchmatch("TimeTaken&amp;gt;15 AND (Termination_Cause="16" OR Termination_Cause="17")")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If case=true, then the event matches the condition.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jan 2011 09:06:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/If-statement-with-multiple-tests/m-p/31300#M365</guid>
      <dc:creator>araitz</dc:creator>
      <dc:date>2011-01-25T09:06:19Z</dc:date>
    </item>
    <item>
      <title>Re: If statement with multiple tests?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/If-statement-with-multiple-tests/m-p/31301#M366</link>
      <description>&lt;P&gt;Please comment when voting down an answer.  My answer is perfectly valid.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jan 2011 14:23:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/If-statement-with-multiple-tests/m-p/31301#M366</guid>
      <dc:creator>araitz</dc:creator>
      <dc:date>2011-01-25T14:23:03Z</dc:date>
    </item>
    <item>
      <title>Re: If statement with multiple tests?</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/If-statement-with-multiple-tests/m-p/31302#M367</link>
      <description>&lt;P&gt;This worked, thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 02 Feb 2011 04:16:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/If-statement-with-multiple-tests/m-p/31302#M367</guid>
      <dc:creator>msarro</dc:creator>
      <dc:date>2011-02-02T04:16:58Z</dc:date>
    </item>
  </channel>
</rss>

