<?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 on Multi Valued Fields in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Eval-on-Multi-Valued-Fields/m-p/34483#M7445</link>
    <description>&lt;P&gt;Thankyou! This works &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 20 Aug 2010 23:57:20 GMT</pubDate>
    <dc:creator>Hazel</dc:creator>
    <dc:date>2010-08-20T23:57:20Z</dc:date>
    <item>
      <title>Eval on Multi Valued Fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-on-Multi-Valued-Fields/m-p/34481#M7443</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I currently have a query that returns a set of results, with a port number and then multiple values of a url for each port like so:&lt;/P&gt;

&lt;PRE&gt;
Port    URL
5170    1
        2
        3
5270    4
        5
        6
&lt;/PRE&gt; 

&lt;P&gt;I want to use this to generate more results.  I need another field based on the answers to URL.  E.g, creating a status field, based on the results of URL.  Something like&lt;/P&gt;

&lt;PRE&gt; eval status = if(match(URL,"2"),"Yes","No") &lt;/PRE&gt;

&lt;P&gt;However, if you do an eval on URL, it just takes the first of the values and evaluating it, ignoring the 2nd and third values.  So i'd want it to check the 1st one (1), answer would be No, check second one (2) answer would be Yes, check third one answer (3) would be No.&lt;/P&gt;

&lt;P&gt;If there any way to run an eval over multi valued fields?&lt;/P&gt;

&lt;P&gt;Thanks
Hazel&lt;/P&gt;</description>
      <pubDate>Fri, 20 Aug 2010 21:27:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-on-Multi-Valued-Fields/m-p/34481#M7443</guid>
      <dc:creator>Hazel</dc:creator>
      <dc:date>2010-08-20T21:27:55Z</dc:date>
    </item>
    <item>
      <title>Re: Eval on Multi Valued Fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-on-Multi-Valued-Fields/m-p/34482#M7444</link>
      <description>&lt;P&gt;There are a couple eval functions that address the case of multivalued fields (http://www.splunk.com/base/Documentation/latest/SearchReference/CommonEvalFunctions). You should specifically look at the ones that start with "mv". In your specific case, you'll probably want to search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eval status = if(mvcount(mvfilter(match(URL,"2"))) &amp;gt; 0, "Yes", "No")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;That said, you should be able to use "==" or match directly in &lt;CODE&gt;eval&lt;/CODE&gt;. Both of these should return true if any of the multivalues is equal or matches. This can be tested using a search like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats count | eval count = "a b c" | makemv count | eval status=if(count == "b", 1, 0)
| stats count | eval count = "a b c" | makemv count | eval status=if(match(count,"b"), 1, 0)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 20 Aug 2010 22:51:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-on-Multi-Valued-Fields/m-p/34482#M7444</guid>
      <dc:creator>Stephen_Sorkin</dc:creator>
      <dc:date>2010-08-20T22:51:23Z</dc:date>
    </item>
    <item>
      <title>Re: Eval on Multi Valued Fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Eval-on-Multi-Valued-Fields/m-p/34483#M7445</link>
      <description>&lt;P&gt;Thankyou! This works &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Aug 2010 23:57:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Eval-on-Multi-Valued-Fields/m-p/34483#M7445</guid>
      <dc:creator>Hazel</dc:creator>
      <dc:date>2010-08-20T23:57:20Z</dc:date>
    </item>
  </channel>
</rss>

