<?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: Can I use an eval statement inside an if statement? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Can-I-use-an-eval-statement-inside-an-if-statement/m-p/421151#M168506</link>
    <description>&lt;P&gt;Still not very clear what your end goal is here.&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;countrycode=NZ and countrycode!=AU&lt;/CODE&gt; is a bit of a pointless condition. If countrycode=NZ, it cannot at the same time be AU. So that &lt;CODE&gt;and countrycode!=AU&lt;/CODE&gt; is redundant here.&lt;/P&gt;

&lt;P&gt;You want one set of employee IDs based on countrycode filter in field a and one set of employee IDs based on areacode filter in field b?&lt;BR /&gt;
Rather than trying to write a solution, can you just functionally/conceptually explain what you want to do?&lt;/P&gt;</description>
    <pubDate>Thu, 05 Jul 2018 14:21:05 GMT</pubDate>
    <dc:creator>FrankVl</dc:creator>
    <dc:date>2018-07-05T14:21:05Z</dc:date>
    <item>
      <title>Can I use an eval statement inside an if statement?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-use-an-eval-statement-inside-an-if-statement/m-p/421144#M168499</link>
      <description>&lt;P&gt;Hi ,&lt;/P&gt;

&lt;P&gt;Can I use an eval statement inside an if?&lt;/P&gt;

&lt;P&gt;I have to implement something like this :&lt;/P&gt;

&lt;P&gt;I have two fields : one  country code and another area code .&lt;BR /&gt;
I have to give list of employee ids who have country code as NZ , country code not like AU and area code like 2345&lt;/P&gt;

&lt;P&gt;Can anyone help me with this?&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jul 2018 12:15:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-use-an-eval-statement-inside-an-if-statement/m-p/421144#M168499</guid>
      <dc:creator>Mohsin123</dc:creator>
      <dc:date>2018-07-05T12:15:58Z</dc:date>
    </item>
    <item>
      <title>Re: Can I use an eval statement inside an if statement?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-use-an-eval-statement-inside-an-if-statement/m-p/421145#M168500</link>
      <description>&lt;P&gt;Hello @shraddhamuduli,&lt;/P&gt;

&lt;P&gt;In what kind of index/table are the information stored? &lt;/P&gt;

&lt;P&gt;Are the 2 fields configured as inut in a dashboard or the result of a query?&lt;/P&gt;

&lt;P&gt;It would be interesting to know in order to be more to the point where providing the answer to your question.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jul 2018 12:24:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-use-an-eval-statement-inside-an-if-statement/m-p/421145#M168500</guid>
      <dc:creator>poete</dc:creator>
      <dc:date>2018-07-05T12:24:19Z</dc:date>
    </item>
    <item>
      <title>Re: Can I use an eval statement inside an if statement?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-use-an-eval-statement-inside-an-if-statement/m-p/421146#M168501</link>
      <description>&lt;P&gt;Can you clarify the data you have (screenshots are most helpful usually) and what exactly you want to achieve?&lt;/P&gt;

&lt;P&gt;You're asking for an eval inside an if, but then you say you just need to filter a list of employees based on country code and area code. That sounds like something you can do with a simple search query. What do you think you need the eval for?&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jul 2018 12:58:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-use-an-eval-statement-inside-an-if-statement/m-p/421146#M168501</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2018-07-05T12:58:13Z</dc:date>
    </item>
    <item>
      <title>Re: Can I use an eval statement inside an if statement?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-use-an-eval-statement-inside-an-if-statement/m-p/421147#M168502</link>
      <description>&lt;P&gt;@Anonymous, Sorry without data and proper explanation, it is not clear what you want to do. Please provide more details on what you currently have and what you expect. Also provide the current query that you have tried.&lt;BR /&gt;
Do you need something like following where country code and area code fields are country_code and area_code respectively?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;yourSearch&amp;gt;
| eval employee_type=case(country_code="NZ","TypeA",country_code="AU" AND area_code=2345,"TypeB",true(),"TypeOthers")
| stats count by employee_type
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Sep 2020 20:20:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-use-an-eval-statement-inside-an-if-statement/m-p/421147#M168502</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2020-09-29T20:20:08Z</dc:date>
    </item>
    <item>
      <title>Re: Can I use an eval statement inside an if statement?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-use-an-eval-statement-inside-an-if-statement/m-p/421148#M168503</link>
      <description>&lt;P&gt;eval a = if( countrycode=NZ and countrycode!=AU , then a= employee ids of both the satisfying condition&lt;BR /&gt;
eval b=if(areacode=2345, then b=employee ids of the satisfying condition &lt;BR /&gt;
combine a and b into c&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jul 2018 13:37:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-use-an-eval-statement-inside-an-if-statement/m-p/421148#M168503</guid>
      <dc:creator>Mohsin123</dc:creator>
      <dc:date>2018-07-05T13:37:50Z</dc:date>
    </item>
    <item>
      <title>Re: Can I use an eval statement inside an if statement?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-use-an-eval-statement-inside-an-if-statement/m-p/421149#M168504</link>
      <description>&lt;P&gt;eval a = if( countrycode=NZ and countrycode!=AU , then a= employee ids of both the satisfying condition&lt;BR /&gt;
eval b=if(areacode=2345, then b=employee ids of the satisfying condition &lt;BR /&gt;
combine a and b into c&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jul 2018 13:38:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-use-an-eval-statement-inside-an-if-statement/m-p/421149#M168504</guid>
      <dc:creator>Mohsin123</dc:creator>
      <dc:date>2018-07-05T13:38:24Z</dc:date>
    </item>
    <item>
      <title>Re: Can I use an eval statement inside an if statement?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-use-an-eval-statement-inside-an-if-statement/m-p/421150#M168505</link>
      <description>&lt;P&gt;Also Niket,&lt;/P&gt;

&lt;P&gt;Can i use 2 where condition in a single search , each where should be made on the base search&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jul 2018 13:58:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-use-an-eval-statement-inside-an-if-statement/m-p/421150#M168505</guid>
      <dc:creator>Mohsin123</dc:creator>
      <dc:date>2018-07-05T13:58:21Z</dc:date>
    </item>
    <item>
      <title>Re: Can I use an eval statement inside an if statement?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-use-an-eval-statement-inside-an-if-statement/m-p/421151#M168506</link>
      <description>&lt;P&gt;Still not very clear what your end goal is here.&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;countrycode=NZ and countrycode!=AU&lt;/CODE&gt; is a bit of a pointless condition. If countrycode=NZ, it cannot at the same time be AU. So that &lt;CODE&gt;and countrycode!=AU&lt;/CODE&gt; is redundant here.&lt;/P&gt;

&lt;P&gt;You want one set of employee IDs based on countrycode filter in field a and one set of employee IDs based on areacode filter in field b?&lt;BR /&gt;
Rather than trying to write a solution, can you just functionally/conceptually explain what you want to do?&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jul 2018 14:21:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-use-an-eval-statement-inside-an-if-statement/m-p/421151#M168506</guid>
      <dc:creator>FrankVl</dc:creator>
      <dc:date>2018-07-05T14:21:05Z</dc:date>
    </item>
    <item>
      <title>Re: Can I use an eval statement inside an if statement?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-use-an-eval-statement-inside-an-if-statement/m-p/421152#M168507</link>
      <description>&lt;P&gt;Splunk eval syntax will look like this &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval &amp;lt;NEW FIELD NAME&amp;gt; = if(&amp;lt;CONDITION&amp;gt;, &amp;lt;TRUE&amp;gt;, &amp;lt;FALSE&amp;gt;)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;There's no &lt;CODE&gt;than&lt;/CODE&gt; inside it&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jul 2018 14:32:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-use-an-eval-statement-inside-an-if-statement/m-p/421152#M168507</guid>
      <dc:creator>skoelpin</dc:creator>
      <dc:date>2018-07-05T14:32:18Z</dc:date>
    </item>
    <item>
      <title>Re: Can I use an eval statement inside an if statement?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-use-an-eval-statement-inside-an-if-statement/m-p/421153#M168508</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval employee_satisfied = case(
   countrycode=NZ AND countrycode!=AU, a,
   areacode=2345, b,
   true(), "Not satisfied")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 05 Jul 2018 16:06:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-use-an-eval-statement-inside-an-if-statement/m-p/421153#M168508</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2018-07-05T16:06:54Z</dc:date>
    </item>
    <item>
      <title>Re: Can I use an eval statement inside an if statement?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-use-an-eval-statement-inside-an-if-statement/m-p/421154#M168509</link>
      <description>&lt;P&gt;hi ,&lt;BR /&gt;
i'm computing this :&lt;BR /&gt;
failure=Uniq(# transaction_id having Req-in, NO Req-out and Response out with status-code=500)/ Uniq(# transaction_id of Req-in)&lt;/P&gt;

&lt;P&gt;fields : logpoint, transaction-id,status-code&lt;BR /&gt;
logpoint values: request-in,request-out,response-in,response-out&lt;/P&gt;

&lt;P&gt;to translate this :&lt;BR /&gt;
failure is the computation result&lt;BR /&gt;
Numerator : unique transaction ids for those logpoints which have request in and no request out AND response out with status code as 500) &lt;BR /&gt;
NOTE : every logpoint has a status code &lt;BR /&gt;
so by response code with status cod=500 means only for response-out&lt;BR /&gt;
Denominator: unique transaction ids with logpoint as request-in&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 20:17:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-use-an-eval-statement-inside-an-if-statement/m-p/421154#M168509</guid>
      <dc:creator>Mohsin123</dc:creator>
      <dc:date>2020-09-29T20:17:36Z</dc:date>
    </item>
  </channel>
</rss>

