<?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: Using field eval values in if condition. in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Using-field-eval-values-in-if-condition/m-p/381101#M172225</link>
    <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;....| eval Srvr=coalesce(Field_1, Field_2, "NA") | table ....rest of the command
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 27 Mar 2019 18:10:12 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2019-03-27T18:10:12Z</dc:date>
    <item>
      <title>Using field eval values in if condition.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-field-eval-values-in-if-condition/m-p/381100#M172224</link>
      <description>&lt;P&gt;I have a search as below:&lt;/P&gt;

&lt;P&gt;|rex field=Field "^(?.+?)." &lt;BR /&gt;
| eval Srvr = if(sourcetype="Type_1", Field_1 , if(sourcetype="Type_2", Field_2, "NA")) &lt;BR /&gt;
| table Id sourcetype Field_1 Srvr &lt;/P&gt;

&lt;P&gt;I have two fields&lt;BR /&gt;
Field_1 that is in sourcetype="Type_1"&lt;BR /&gt;
Field_2 that is in sourcetype="Type_2"&lt;BR /&gt;
I want to take the values of these field in one field that is Srvr in the searxh above.&lt;/P&gt;

&lt;P&gt;Please suggest as the query is not picking up the values from the fields Field_1 and Filed_2 but the if condition is working with harcoded values.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 23:52:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-field-eval-values-in-if-condition/m-p/381100#M172224</guid>
      <dc:creator>veerendra_modi</dc:creator>
      <dc:date>2020-09-29T23:52:53Z</dc:date>
    </item>
    <item>
      <title>Re: Using field eval values in if condition.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-field-eval-values-in-if-condition/m-p/381101#M172225</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;....| eval Srvr=coalesce(Field_1, Field_2, "NA") | table ....rest of the command
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 27 Mar 2019 18:10:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-field-eval-values-in-if-condition/m-p/381101#M172225</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2019-03-27T18:10:12Z</dc:date>
    </item>
  </channel>
</rss>

