<?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: How can you get a single value based on eval results? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-can-you-get-a-single-value-based-on-eval-results/m-p/381509#M111583</link>
    <description>&lt;P&gt;Try this.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eval "Section Status"=case(SectionTitle == "1.1" AND total == "3", "Completed",  
 SectionTitle == "1.2 " AND total == "4", "Completed", 
 SectionTitle == "1.3" AND total == "3", "Completed", 
 true(), "Incomplete")
| stats count(eval('Section Status'="Incomplete)) as IncompleteCount values(total) as total values(SectionTitle) as SectionTitle
| eval Status=if(IncompleteCount=0, "Completed", "Incomplete")
|rename total as "Questions Answered" SectionTitle as "Section Title"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 13 Sep 2018 22:09:37 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2018-09-13T22:09:37Z</dc:date>
    <item>
      <title>How can you get a single value based on eval results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-you-get-a-single-value-based-on-eval-results/m-p/381508#M111582</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I have a search that joins together data. The search works great, but the results that Im trying to get are proving a bit tricky.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=tsv 
|rename BOID AS id
|dedup SurveyInstanceID QuestionID QuestionText QuestionAnswer QuestionAnswerWeight

|join id [`init(assessments)` 
|rename info_name as assessmentName
|dedup assessmentName
|`fp_mvexpand(related_vendors)`
|eval RV = mvindex(related_vendors,0) ]

|join RV [ `init(vendors)`
|rename id as RV info_name as Vendor
|dedup Vendor]

| search Vendor=$vendor$

|streamstats count(QuestionID) by SectionTitle
|rename count(QuestionID) as total

| eval "Section Status"=case(SectionTitle == "1.1" AND total == "3", "Completed",  
SectionTitle == "1.2 " AND total == "4", "Completed", 
SectionTitle == "1.3" AND total == "3", "Completed", 
true(), "Incomplete")
|rename total as "Questions Answered" SectionTitle as "Section Title"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The goal is that if  "Section Status" == "Incomplete" AT ALL, return "Incomplete" otherwise its "Complete" .&lt;/P&gt;

&lt;P&gt;This causes every record to be evaluated which is not what Im trying to get. I only need it to return a single result.&lt;/P&gt;

&lt;P&gt;So if lets say&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;SectionTitle == "1.1" AND total == "3"  
    SectionTitle == "1.2 " AND total == "2"
    SectionTitle == "1.3" AND total == "3"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The result would be "Incomplete"&lt;/P&gt;

&lt;P&gt;I plan on making this a single value panel on a dashboard&lt;/P&gt;

&lt;P&gt;Thanks for the assistance&lt;/P&gt;</description>
      <pubDate>Thu, 13 Sep 2018 20:18:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-you-get-a-single-value-based-on-eval-results/m-p/381508#M111582</guid>
      <dc:creator>tkwaller_2</dc:creator>
      <dc:date>2018-09-13T20:18:49Z</dc:date>
    </item>
    <item>
      <title>Re: How can you get a single value based on eval results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-you-get-a-single-value-based-on-eval-results/m-p/381509#M111583</link>
      <description>&lt;P&gt;Try this.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eval "Section Status"=case(SectionTitle == "1.1" AND total == "3", "Completed",  
 SectionTitle == "1.2 " AND total == "4", "Completed", 
 SectionTitle == "1.3" AND total == "3", "Completed", 
 true(), "Incomplete")
| stats count(eval('Section Status'="Incomplete)) as IncompleteCount values(total) as total values(SectionTitle) as SectionTitle
| eval Status=if(IncompleteCount=0, "Completed", "Incomplete")
|rename total as "Questions Answered" SectionTitle as "Section Title"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 13 Sep 2018 22:09:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-you-get-a-single-value-based-on-eval-results/m-p/381509#M111583</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2018-09-13T22:09:37Z</dc:date>
    </item>
    <item>
      <title>Re: How can you get a single value based on eval results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-you-get-a-single-value-based-on-eval-results/m-p/381510#M111584</link>
      <description>&lt;P&gt;yep that worked, I just added "|fields Status" and then made it into a single value panel.&lt;BR /&gt;
Thanks for the help!&lt;/P&gt;</description>
      <pubDate>Fri, 14 Sep 2018 19:39:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-you-get-a-single-value-based-on-eval-results/m-p/381510#M111584</guid>
      <dc:creator>tkwaller_2</dc:creator>
      <dc:date>2018-09-14T19:39:49Z</dc:date>
    </item>
  </channel>
</rss>

