<?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 chooose one value based on applying conditions to table column in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-chooose-one-value-based-on-applying-conditions-to-table/m-p/523127#M147547</link>
    <description>&lt;P&gt;I have a table like below. Which plots different services under one column Service A (Subservices - A1 to A5) / Service B (Subservices - B1 to B5) .&amp;nbsp; I need to take a new column denotes one Final Status like this if any of one Status is RED then the final status is RED, If there is no RED but one YELLOW And many GREEN then final status if YELLOW. What will be the best condition i can use to achieve the final one result&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="50%"&gt;Service&lt;/TD&gt;&lt;TD width="50%"&gt;Status&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;A1&lt;/TD&gt;&lt;TD width="50%"&gt;GREEN&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;A2&lt;/TD&gt;&lt;TD width="50%"&gt;RED&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;A3&lt;/TD&gt;&lt;TD width="50%"&gt;YELLOW&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;A4&amp;nbsp;&lt;/TD&gt;&lt;TD width="50%"&gt;GREEN&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;A5&lt;/TD&gt;&lt;TD width="50%"&gt;GREEN&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
    <pubDate>Tue, 06 Oct 2020 08:21:24 GMT</pubDate>
    <dc:creator>Naga</dc:creator>
    <dc:date>2020-10-06T08:21:24Z</dc:date>
    <item>
      <title>How to chooose one value based on applying conditions to table column</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-chooose-one-value-based-on-applying-conditions-to-table/m-p/523127#M147547</link>
      <description>&lt;P&gt;I have a table like below. Which plots different services under one column Service A (Subservices - A1 to A5) / Service B (Subservices - B1 to B5) .&amp;nbsp; I need to take a new column denotes one Final Status like this if any of one Status is RED then the final status is RED, If there is no RED but one YELLOW And many GREEN then final status if YELLOW. What will be the best condition i can use to achieve the final one result&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="50%"&gt;Service&lt;/TD&gt;&lt;TD width="50%"&gt;Status&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;A1&lt;/TD&gt;&lt;TD width="50%"&gt;GREEN&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;A2&lt;/TD&gt;&lt;TD width="50%"&gt;RED&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;A3&lt;/TD&gt;&lt;TD width="50%"&gt;YELLOW&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;A4&amp;nbsp;&lt;/TD&gt;&lt;TD width="50%"&gt;GREEN&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="50%"&gt;A5&lt;/TD&gt;&lt;TD width="50%"&gt;GREEN&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Tue, 06 Oct 2020 08:21:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-chooose-one-value-based-on-applying-conditions-to-table/m-p/523127#M147547</guid>
      <dc:creator>Naga</dc:creator>
      <dc:date>2020-10-06T08:21:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to chooose one value based on applying conditions to table column</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-chooose-one-value-based-on-applying-conditions-to-table/m-p/523129#M147548</link>
      <description>&lt;P&gt;Try&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;|eventstats values(Status) as StatusList by Parent
|eval FinalStatus=case(isnotnull(mvfind(StatusList,"RED")),"RED",isnotnull(mvfind(StatusList,"YELLOW")),"YELLOW",isnotnull(mvfind(StatusList,"GREEN")),"GREEN",1==1,"NA")
|fields - StatusList&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here Parent is 'A'&lt;/P&gt;&lt;P&gt;Run anywhere example&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;|makeresults|eval Service="A1 A2 A3 A4 A5"|makemv Service|mvexpand Service
|appendcols [|makeresults | eval Status="GREEN RED YELLOW GREEN GREEN"|makemv Status|mvexpand Status]
|table Service, Status
|rex field=Service "(?&amp;lt;Parent&amp;gt;\D+)"
|eventstats values(Status) as StatusList by Parent
|eval FinalStatus=case(isnotnull(mvfind(StatusList,"RED")),"RED",isnotnull(mvfind(StatusList,"YELLOW")),"YELLOW",isnotnull(mvfind(StatusList,"GREEN")),"GREEN",1==1,"NA")
|fields - StatusList&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Parent extraction is a simple rex for this dummy data and you should change based on actual data&lt;/P&gt;&lt;P&gt;You can replace &lt;STRONG&gt;&lt;EM&gt;eventstats &lt;/EM&gt;&lt;/STRONG&gt;with &lt;STRONG&gt;&lt;EM&gt;stats &lt;/EM&gt;&lt;/STRONG&gt;if you want only one status per service&lt;/P&gt;</description>
      <pubDate>Tue, 06 Oct 2020 08:40:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-chooose-one-value-based-on-applying-conditions-to-table/m-p/523129#M147548</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2020-10-06T08:40:37Z</dc:date>
    </item>
  </channel>
</rss>

