<?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 How to edit my eval statements to assign a value for a field when join returns no rows? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-eval-statements-to-assign-a-value-for-a-field/m-p/252454#M75553</link>
    <description>&lt;PRE&gt;&lt;CODE&gt;index="Index1" sourcetype="response" | eval running_ok = if(response_status="Running","0","1") |head 1
|join running_ok
[search index="Index1" sourcetype="monitor" | eval running_ok = if(monitor_status="Running","0","1")|head 1] 
|eval final = if(running_ok==0,0,1)
|eval final = if(running_ok==" " OR running_ok==1,1,0) |table final | outputlookup output.csv 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I am using join on two sourcetypes for the field "running_ok".&lt;/P&gt;

&lt;P&gt;The following table is derived based on how the inner join functions.&lt;BR /&gt;
Main search "running_ok" result), (Sub search "running_ok" result)= 0 or 1 or Blank (Join Search returned no values.)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;0,0=0 (Running)
1,0= blank (Not Running)
0,1= blank (Not Running)
1,1=1 (Not Running)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;From these below, I am able to assign required value for "final" when running_ok=0 or 1, but I could not assign value for "final" when "Join search returns no values."&lt;BR /&gt;
Please  let me know the way when join search returns no rows.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|eval final = if(running_ok==0,0,1)
|eval final = if(running_ok=="Join search returns no values." OR running_ok==1,1,0) 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The following two did not help either.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval final=if(match(running_ok, "No results") OR running_ok=1, 1, 0) |
| eval final = if(isnull(running_ok) OR running_ok==1,1,0)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 29 Sep 2020 11:57:40 GMT</pubDate>
    <dc:creator>email2vamsi</dc:creator>
    <dc:date>2020-09-29T11:57:40Z</dc:date>
    <item>
      <title>How to edit my eval statements to assign a value for a field when join returns no rows?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-eval-statements-to-assign-a-value-for-a-field/m-p/252454#M75553</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;index="Index1" sourcetype="response" | eval running_ok = if(response_status="Running","0","1") |head 1
|join running_ok
[search index="Index1" sourcetype="monitor" | eval running_ok = if(monitor_status="Running","0","1")|head 1] 
|eval final = if(running_ok==0,0,1)
|eval final = if(running_ok==" " OR running_ok==1,1,0) |table final | outputlookup output.csv 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I am using join on two sourcetypes for the field "running_ok".&lt;/P&gt;

&lt;P&gt;The following table is derived based on how the inner join functions.&lt;BR /&gt;
Main search "running_ok" result), (Sub search "running_ok" result)= 0 or 1 or Blank (Join Search returned no values.)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;0,0=0 (Running)
1,0= blank (Not Running)
0,1= blank (Not Running)
1,1=1 (Not Running)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;From these below, I am able to assign required value for "final" when running_ok=0 or 1, but I could not assign value for "final" when "Join search returns no values."&lt;BR /&gt;
Please  let me know the way when join search returns no rows.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|eval final = if(running_ok==0,0,1)
|eval final = if(running_ok=="Join search returns no values." OR running_ok==1,1,0) 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The following two did not help either.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval final=if(match(running_ok, "No results") OR running_ok=1, 1, 0) |
| eval final = if(isnull(running_ok) OR running_ok==1,1,0)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Sep 2020 11:57:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-eval-statements-to-assign-a-value-for-a-field/m-p/252454#M75553</guid>
      <dc:creator>email2vamsi</dc:creator>
      <dc:date>2020-09-29T11:57:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my eval statements to assign a value for a field when join returns no rows?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-eval-statements-to-assign-a-value-for-a-field/m-p/252455#M75554</link>
      <description>&lt;P&gt;try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="Index1" sourcetype="response" OR sourcetype="monitor"| eval running_ok = if(response_status="Running" OR monitor_status="Running","0","1") |head 1
 |fillnull running_ok value=1
 |eval final = if(running_ok==1,1,0) |table final | outputlookup output.csv
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 01 Dec 2016 12:52:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-eval-statements-to-assign-a-value-for-a-field/m-p/252455#M75554</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2016-12-01T12:52:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my eval statements to assign a value for a field when join returns no rows?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-eval-statements-to-assign-a-value-for-a-field/m-p/252456#M75555</link>
      <description>&lt;P&gt;Thank you. I am going to try it and update.&lt;BR /&gt;
What does the following mean?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|fillnull running_ok value=1
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 01 Dec 2016 13:17:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-eval-statements-to-assign-a-value-for-a-field/m-p/252456#M75555</guid>
      <dc:creator>email2vamsi</dc:creator>
      <dc:date>2016-12-01T13:17:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my eval statements to assign a value for a field when join returns no rows?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-eval-statements-to-assign-a-value-for-a-field/m-p/252457#M75556</link>
      <description>&lt;P&gt;you had two final eval statements, which I didn't understand the need for, and in one eval statement, you had &lt;CODE&gt;running_ok=" "&lt;/CODE&gt; and the fillnull statement would just fill all null values with the value 1, so you wouldn't need that in the eval.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Dec 2016 13:50:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-eval-statements-to-assign-a-value-for-a-field/m-p/252457#M75556</guid>
      <dc:creator>cmerriman</dc:creator>
      <dc:date>2016-12-01T13:50:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my eval statements to assign a value for a field when join returns no rows?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-eval-statements-to-assign-a-value-for-a-field/m-p/252458#M75557</link>
      <description>&lt;P&gt;In the eval statement &lt;CODE&gt;running_ok=" "&lt;/CODE&gt; i am looking for query which did not return any rows(No results found. ).&lt;BR /&gt;
I am sure it is not the right way to check it. I am looking for the right way to check "No results found. " &lt;BR /&gt;
Because the join does not return any rows when no match happens. I am trying to catch those kind of entries,which will have "No results found".&lt;/P&gt;</description>
      <pubDate>Thu, 01 Dec 2016 14:02:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-eval-statements-to-assign-a-value-for-a-field/m-p/252458#M75557</guid>
      <dc:creator>email2vamsi</dc:creator>
      <dc:date>2016-12-01T14:02:10Z</dc:date>
    </item>
  </channel>
</rss>

