<?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 with conditions in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Eval-with-conditions/m-p/546994#M155073</link>
    <description>&lt;P&gt;great! thank you&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;for your patience. Now I understand! Many thanks!&lt;/P&gt;</description>
    <pubDate>Wed, 07 Apr 2021 09:19:17 GMT</pubDate>
    <dc:creator>zoe</dc:creator>
    <dc:date>2021-04-07T09:19:17Z</dc:date>
    <item>
      <title>Eval with conditions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-with-conditions/m-p/546981#M155065</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have 3 products 1, 2, and 3, each of them contain several elements a, b c, d. Each product has different specification depending on the elements %&lt;/P&gt;&lt;P&gt;Product 1:&amp;nbsp; a1&amp;lt;a&amp;lt;a2, b1&amp;lt;b&amp;lt;b2, c1&amp;lt;c&amp;lt;c2&lt;/P&gt;&lt;P&gt;Product 2:&amp;nbsp; a3&amp;lt;a&amp;lt;a4, b3&amp;lt;b&amp;lt;b4, d3&amp;lt;d&amp;lt;d4&lt;/P&gt;&lt;P&gt;product 3:&amp;nbsp;a5&amp;lt;a&amp;lt;a6, b5&amp;lt;b&amp;lt;b6, c5&amp;lt;c&amp;lt;c6,&amp;nbsp;d5&amp;lt;d&amp;lt;d6&lt;/P&gt;&lt;P&gt;I would like to have a list&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Product , a, b, c, d, In_Spec&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;I would like to use eval to assign the value to In_Spec&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;|eval In_Spec=( if&amp;nbsp;Product=1 and&amp;nbsp; a1&amp;lt;a&amp;lt;a2 and b1&amp;lt;b&amp;lt;b2 and c1&amp;lt;c&amp;lt;c2, "yes", "no")&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;but How can include product 2 and product 2? In the end I want sth like:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;|eval In_Spec=( if Product 1.......... Product2........... Product 3............"yes", "no")&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;can someone help me with that?&lt;/P&gt;&lt;P&gt;Many thanks in advance!&lt;/P&gt;</description>
      <pubDate>Wed, 07 Apr 2021 08:17:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-with-conditions/m-p/546981#M155065</guid>
      <dc:creator>zoe</dc:creator>
      <dc:date>2021-04-07T08:17:34Z</dc:date>
    </item>
    <item>
      <title>Re: Eval with conditions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-with-conditions/m-p/546983#M155066</link>
      <description>&lt;P&gt;You can nest if's&lt;/P&gt;&lt;P&gt;if(product=1,if(a&amp;gt;a1 AND a&amp;lt;a2 AND b ...,"yes","no"),if(product=2,if(...,"yes","no"),if(product...)))&lt;/P&gt;&lt;P&gt;or in a similar vein, use a case&lt;/P&gt;&lt;P&gt;case(product=1,if(...),product=2,if(...)...)&lt;/P&gt;</description>
      <pubDate>Wed, 07 Apr 2021 08:27:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-with-conditions/m-p/546983#M155066</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-04-07T08:27:32Z</dc:date>
    </item>
    <item>
      <title>Re: Eval with conditions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-with-conditions/m-p/546984#M155067</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp; thanks for the quick reply. But i am confused with so many brackets.&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I understand this correctly:&lt;/P&gt;&lt;P&gt;|eval In_Spec=if((Product=1, if(..., "yes", "no"), if (Product=2, if(...) "yes", "no"), if(Product=3, if(...., yes", "no" ))&lt;/P&gt;&lt;P&gt;But why do you have three brackets at the end?&lt;/P&gt;</description>
      <pubDate>Wed, 07 Apr 2021 08:44:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-with-conditions/m-p/546984#M155067</guid>
      <dc:creator>zoe</dc:creator>
      <dc:date>2021-04-07T08:44:05Z</dc:date>
    </item>
    <item>
      <title>Re: Eval with conditions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-with-conditions/m-p/546988#M155071</link>
      <description>&lt;P&gt;The if function has only 3 parameter, condition, action if true, action if false. So, to represent it in a more structured way it might look like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;if condition1
then action1
else action2
endif&lt;/LI-CODE&gt;&lt;P&gt;When the actions are themselves if's it starts to look like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;if condition1
then if condition1.1
     then action1T
     else action1F
     endif
else if condition2
     then if condition2.1
          then action2T
          else action2F
          endif
     else if condition3
          then if condition3.1
               then action3T
               else action3F
               endif
          endif
     endif
endif&lt;/LI-CODE&gt;&lt;P&gt;As you can see, all the endifs come together at the end to close off all the levels of nesting. This is what the brackets are doing in the splunk syntax&lt;/P&gt;</description>
      <pubDate>Wed, 07 Apr 2021 09:08:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-with-conditions/m-p/546988#M155071</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-04-07T09:08:47Z</dc:date>
    </item>
    <item>
      <title>Re: Eval with conditions</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-with-conditions/m-p/546994#M155073</link>
      <description>&lt;P&gt;great! thank you&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;for your patience. Now I understand! Many thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 07 Apr 2021 09:19:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-with-conditions/m-p/546994#M155073</guid>
      <dc:creator>zoe</dc:creator>
      <dc:date>2021-04-07T09:19:17Z</dc:date>
    </item>
  </channel>
</rss>

