<?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 Condition in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Condition/m-p/553499#M91769</link>
    <description>&lt;P&gt;c1 = US, c2 = UAE&lt;/P&gt;&lt;P&gt;L1 = English, L2 = Arabic&lt;/P&gt;&lt;P&gt;I want to get the answer in "ans" like,&amp;nbsp;&lt;/P&gt;&lt;P&gt;If c1= US,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; then ans= L1&lt;/P&gt;&lt;P&gt;elseif c2 = UAE,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;then ans= L2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 28 May 2021 12:49:07 GMT</pubDate>
    <dc:creator>Khuzair81</dc:creator>
    <dc:date>2021-05-28T12:49:07Z</dc:date>
    <item>
      <title>Condition</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Condition/m-p/553499#M91769</link>
      <description>&lt;P&gt;c1 = US, c2 = UAE&lt;/P&gt;&lt;P&gt;L1 = English, L2 = Arabic&lt;/P&gt;&lt;P&gt;I want to get the answer in "ans" like,&amp;nbsp;&lt;/P&gt;&lt;P&gt;If c1= US,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; then ans= L1&lt;/P&gt;&lt;P&gt;elseif c2 = UAE,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;then ans= L2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 May 2021 12:49:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Condition/m-p/553499#M91769</guid>
      <dc:creator>Khuzair81</dc:creator>
      <dc:date>2021-05-28T12:49:07Z</dc:date>
    </item>
    <item>
      <title>Re: Condition</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Condition/m-p/553507#M91772</link>
      <description>&lt;P&gt;Splunk supports conditions using the if and case functions.&amp;nbsp; RTM at&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/Splunk/8.2.0/SearchReference/ConditionalFunctions" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/8.2.0/SearchReference/ConditionalFunctions&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Some examples, using a modification of the example logic (which will never execute the else clause):&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval ans=if(c="US", "English","Arabic")

| eval ans=case(c="US", "English", c="UAE", "Arabic", 1==1, "Other")

| eval L1="English", L2="Arabic"
| eval ans=case(c="US", L1, c="UAE", L2, 1==1, "Other")&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 28 May 2021 13:09:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Condition/m-p/553507#M91772</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2021-05-28T13:09:57Z</dc:date>
    </item>
    <item>
      <title>Re: Condition</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Condition/m-p/553569#M91778</link>
      <description>&lt;OL&gt;&lt;LI&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/213957"&gt;@richgalloway&lt;/a&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Please help in the below Query&lt;/P&gt;&lt;P&gt;c=US, UAE&lt;/P&gt;&lt;P&gt;Lang=English, Arabic&lt;/P&gt;&lt;P&gt;........... | rex fields=Lang "(? &amp;lt;myval&amp;gt;)"&amp;nbsp;&lt;/P&gt;&lt;P&gt;|&amp;nbsp; eval ans=case(c="US",myval)&amp;nbsp; | table ans, myval&lt;/P&gt;&lt;P&gt;I'm getting the 'ans' field as blank while 'myval' field has the Value.&lt;/P&gt;</description>
      <pubDate>Fri, 28 May 2021 18:21:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Condition/m-p/553569#M91778</guid>
      <dc:creator>Khuzair81</dc:creator>
      <dc:date>2021-05-28T18:21:12Z</dc:date>
    </item>
    <item>
      <title>Re: Condition</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Condition/m-p/553578#M91780</link>
      <description>&lt;P&gt;The 'ans' field is blank because the 'c' field value is not "US".&amp;nbsp; If none of the expressions in a &lt;FONT face="courier new,courier"&gt;case&lt;/FONT&gt; function evaluate to true then the result is NULL.&amp;nbsp; That is why it's good practice to ensure the last expression always is true by using "&lt;FONT face="courier new,courier"&gt;1==1&lt;/FONT&gt;" or "&lt;FONT face="courier new,courier"&gt;true()&lt;/FONT&gt;".&lt;/P&gt;</description>
      <pubDate>Fri, 28 May 2021 19:08:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Condition/m-p/553578#M91780</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2021-05-28T19:08:43Z</dc:date>
    </item>
    <item>
      <title>Re: Condition</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Condition/m-p/553612#M91784</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/213957"&gt;@richgalloway&lt;/a&gt;&lt;/P&gt;&lt;P&gt;c= US&lt;/P&gt;&lt;P&gt;Language = abcdENGLISH123qw&lt;/P&gt;&lt;P&gt;..... | rex fields=Language "\w{4}(?&amp;lt;myval&amp;gt;)\d{4}"&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;|&amp;nbsp; eval ans=case(c="US",myval, true(),&amp;nbsp; "NA" )&amp;nbsp; | table ans, myval, c&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Result&lt;/P&gt;&lt;P&gt;ans = NA&lt;/P&gt;&lt;P&gt;myval = English&lt;/P&gt;&lt;P&gt;c = US&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want the ans = English&lt;/P&gt;</description>
      <pubDate>Sat, 29 May 2021 07:05:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Condition/m-p/553612#M91784</guid>
      <dc:creator>Khuzair81</dc:creator>
      <dc:date>2021-05-29T07:05:38Z</dc:date>
    </item>
    <item>
      <title>Re: Condition</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Condition/m-p/553616#M91786</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225651"&gt;@Khuzair81&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you please try this?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;YOUR_SEARCH
| eval c=split(c,","), Lang=split(Lang,",")
| eval Ans = mvindex(Lang,mvfind(c,"US"))
| table Ans&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here "US" is the value what I want to get Lang.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;My Sample Search :&lt;/STRONG&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults 
| eval c="US,UAE",Lang="English,Arabic"
| eval c=split(c,","), Lang=split(Lang,",")
| eval Ans = mvindex(Lang,mvfind(c,"US"))
| table Ans&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;BR /&gt;KV&lt;BR /&gt;▄︻̷̿┻̿═━一&lt;BR /&gt;&lt;BR /&gt;If any of my reply helps you to solve the problem Or gain knowledge, an upvote would be appreciated.&lt;/P&gt;</description>
      <pubDate>Sat, 29 May 2021 08:02:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Condition/m-p/553616#M91786</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2021-05-29T08:02:13Z</dc:date>
    </item>
  </channel>
</rss>

