<?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 Case Formula in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Eval-Case-Formula/m-p/361937#M106933</link>
    <description>&lt;P&gt;converted to answer, if it worked for you, please accept it and mark as answered&lt;/P&gt;</description>
    <pubDate>Fri, 11 Aug 2017 13:07:54 GMT</pubDate>
    <dc:creator>adonio</dc:creator>
    <dc:date>2017-08-11T13:07:54Z</dc:date>
    <item>
      <title>Eval Case Formula</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-Case-Formula/m-p/361932#M106928</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Struggling to complete an Eval Case syntax. I want to create a situation where I have a new field called provider based on certain criteria.&lt;/P&gt;

&lt;P&gt;Provider: &lt;BR /&gt;
XYZ (if D1_Code equals X and current team does not equal &lt;EM&gt;ABC&lt;/EM&gt; or &lt;EM&gt;DEF&lt;/EM&gt;)&lt;BR /&gt;
ABC (if current team equals &lt;EM&gt;ABC&lt;/EM&gt;) - wildcards needed as there are variants of ABC&lt;BR /&gt;
DEF (if current team equals &lt;EM&gt;DEF&lt;/EM&gt;) - wildcards needed as there are variants of DEF&lt;/P&gt;

&lt;P&gt;Search string is |  eval Provider=case(D1_Code="X" AND Current_Team!="&lt;EM&gt;ABC&lt;/EM&gt;" AND Current_Team!="&lt;EM&gt;DEF&lt;/EM&gt;", "XYZ", Current_Team="&lt;EM&gt;ABC&lt;/EM&gt;", "ABC", Current_Team="&lt;EM&gt;DEF&lt;/EM&gt;", "DEF")&lt;/P&gt;

&lt;P&gt;The first part of the eval works on it's own but when I try and add criteria for ABC and DEF it will not work. &lt;BR /&gt;
Provider=case(D1_Code="X" AND Current_Team!="&lt;EM&gt;ABC&lt;/EM&gt;" AND Current_Team!="&lt;EM&gt;DEF&lt;/EM&gt;")&lt;/P&gt;

&lt;P&gt;Could anyone please advice? Not sure if case is the right thing to use here.&lt;/P&gt;

&lt;P&gt;Thanks in advance&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 15:18:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-Case-Formula/m-p/361932#M106928</guid>
      <dc:creator>jackreeves</dc:creator>
      <dc:date>2020-09-29T15:18:20Z</dc:date>
    </item>
    <item>
      <title>Re: Eval Case Formula</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-Case-Formula/m-p/361933#M106929</link>
      <description>&lt;P&gt;great answer here:&lt;BR /&gt;
&lt;A href="https://answers.splunk.com/answers/170602/how-would-i-use-eval-with-a-wildcard-to-create-a-c.html"&gt;https://answers.splunk.com/answers/170602/how-would-i-use-eval-with-a-wildcard-to-create-a-c.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Aug 2017 17:58:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-Case-Formula/m-p/361933#M106929</guid>
      <dc:creator>adonio</dc:creator>
      <dc:date>2017-08-10T17:58:44Z</dc:date>
    </item>
    <item>
      <title>Re: Eval Case Formula</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-Case-Formula/m-p/361934#M106930</link>
      <description>&lt;P&gt;How about you change the order, like this...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;....| eval Provider=case(Current_Team="ABC", "ABC", Current_Team="DEF", "DEF",D1_Code="X", "XYZ")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Also,  if you want to match with wildcards (you need to provide actual sample values for better suggestions), try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;....| eval Provider=case(match(Current_Team,"ABC"), "ABC", match(Current_Team,"DEF"), "DEF",D1_Code="X", "XYZ")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 10 Aug 2017 18:03:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-Case-Formula/m-p/361934#M106930</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-08-10T18:03:06Z</dc:date>
    </item>
    <item>
      <title>Re: Eval Case Formula</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-Case-Formula/m-p/361935#M106931</link>
      <description>&lt;P&gt;This works for me: &lt;CODE&gt;| makeresults | eval D1_Code="X", Current_Team="DEF" | eval Provider=case( (D1_Code="X" AND Current_Team!="ABC" AND Current_Team!="DEF"), "XYZ", Current_Team="ABC", "ABC", Current_Team="DEF", "DEF")&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Aug 2017 18:04:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-Case-Formula/m-p/361935#M106931</guid>
      <dc:creator>s2_splunk</dc:creator>
      <dc:date>2017-08-10T18:04:19Z</dc:date>
    </item>
    <item>
      <title>Re: Eval Case Formula</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-Case-Formula/m-p/361936#M106932</link>
      <description>&lt;P&gt;Brilliant - this solved the issue!&lt;/P&gt;

&lt;P&gt;Many thanks&lt;/P&gt;</description>
      <pubDate>Fri, 11 Aug 2017 08:14:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-Case-Formula/m-p/361936#M106932</guid>
      <dc:creator>jackreeves</dc:creator>
      <dc:date>2017-08-11T08:14:22Z</dc:date>
    </item>
    <item>
      <title>Re: Eval Case Formula</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-Case-Formula/m-p/361937#M106933</link>
      <description>&lt;P&gt;converted to answer, if it worked for you, please accept it and mark as answered&lt;/P&gt;</description>
      <pubDate>Fri, 11 Aug 2017 13:07:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-Case-Formula/m-p/361937#M106933</guid>
      <dc:creator>adonio</dc:creator>
      <dc:date>2017-08-11T13:07:54Z</dc:date>
    </item>
  </channel>
</rss>

