<?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: If Statement with different fields in Reporting</title>
    <link>https://community.splunk.com/t5/Reporting/If-Statement-with-different-fields/m-p/533632#M8642</link>
    <description>&lt;P&gt;This is the part where the sample data is created.&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;%&amp;nbsp;&lt;/STRONG&gt;is modulo operator(&lt;A href="https://en.wikipedia.org/wiki/Modulo_operation" target="_blank"&gt;https://en.wikipedia.org/wiki/Modulo_operation&lt;/A&gt;)&lt;/P&gt;&lt;P&gt;ref:&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Eval#Operators" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Eval#Operators&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;random() with % &lt;/STRONG&gt;creates random "modulo numbers -1".&lt;/P&gt;&lt;P&gt;ref:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/8.1.1/SearchReference/StatisticalFunctions#random.28.29" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/8.1.1/SearchReference/StatisticalFunctions#random.28.29&lt;/A&gt;&lt;/P&gt;&lt;P&gt;so,&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval cookies=(random() % 3) - 1&lt;/LI-CODE&gt;&lt;P&gt;makes cookies&amp;nbsp; -1, 0,&amp;nbsp; 1.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;random() % 2&lt;/LI-CODE&gt;&lt;P&gt;makes 0 ,1.&lt;/P&gt;&lt;P&gt;so, Stages is "NotReady" or "Ready" randomly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 19 Dec 2020 01:07:51 GMT</pubDate>
    <dc:creator>to4kawa</dc:creator>
    <dc:date>2020-12-19T01:07:51Z</dc:date>
    <item>
      <title>If Statement with different fields</title>
      <link>https://community.splunk.com/t5/Reporting/If-Statement-with-different-fields/m-p/532888#M8627</link>
      <description>&lt;P&gt;Hello Splunk Community,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have not mastered complex if statements. I would like to know how I can get the following results:&lt;BR /&gt;&lt;BR /&gt;1. If&amp;nbsp; cookies are &amp;gt;=1 then output should be "Failure"&lt;BR /&gt;&lt;BR /&gt;2. If cookies are &amp;lt; 0 then output should also be "Failure"&lt;BR /&gt;&lt;BR /&gt;3. If cookies are = 0 AND if stage for this scenario is not ready, then output should be "In Progress"&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Below is my logic for this query, but its not providing any results and its malformed, any help is appreciated.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval Bakes=if(cookies&amp;gt;="1", "Failure"), if (cookies&amp;lt;"0" "Failure"), if (cookies="0", "In Progress" AND Stages!="NotReady", "In Progress")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 12 Dec 2020 02:42:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/If-Statement-with-different-fields/m-p/532888#M8627</guid>
      <dc:creator>Mary666</dc:creator>
      <dc:date>2020-12-12T02:42:16Z</dc:date>
    </item>
    <item>
      <title>Re: If Statement with different fields</title>
      <link>https://community.splunk.com/t5/Reporting/If-Statement-with-different-fields/m-p/532889#M8628</link>
      <description>&lt;P&gt;Just a correction, stage should not equal to ---&amp;gt; "NotReady" Therefore, the Stages!="NotReady"&lt;/P&gt;</description>
      <pubDate>Sat, 12 Dec 2020 02:48:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/If-Statement-with-different-fields/m-p/532889#M8628</guid>
      <dc:creator>Mary666</dc:creator>
      <dc:date>2020-12-12T02:48:46Z</dc:date>
    </item>
    <item>
      <title>Re: If Statement with different fields</title>
      <link>https://community.splunk.com/t5/Reporting/If-Statement-with-different-fields/m-p/532893#M8629</link>
      <description>&lt;LI-CODE lang="markup"&gt;| makeresults count=10
| eval cookies=(random() % 3) - 1, Stages=mvindex(split("NotReady,Ready",","),random() % 2)
| eval Bakes=case(cookies &amp;gt;=1 OR cookies &amp;lt; 0, "Failure", cookies="0" AND Stages!="NotReady", "In Progress",true(), "Failure")
| table cookies Stages Bakes&lt;/LI-CODE&gt;&lt;P&gt;How about &lt;STRONG&gt;case&lt;/STRONG&gt;?&lt;/P&gt;</description>
      <pubDate>Sat, 12 Dec 2020 10:26:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/If-Statement-with-different-fields/m-p/532893#M8629</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-12-12T10:26:18Z</dc:date>
    </item>
    <item>
      <title>Re: If Statement with different fields</title>
      <link>https://community.splunk.com/t5/Reporting/If-Statement-with-different-fields/m-p/532904#M8630</link>
      <description>&lt;P&gt;It seems to me that you can simplify your scenario a bit:&lt;/P&gt;&lt;P&gt;( cookies&amp;lt;0 AND cookies&amp;gt;=1) means: unless cookies is exactly 0 then its a failure.&lt;/P&gt;&lt;P&gt;If stage is "Not Ready" then your status is "In Progress"&lt;/P&gt;&lt;P&gt;Therefore there are only two conditions you need to test:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval Bakes=case(cookies!=0, "Failure", Stages="NotReady", "In Progress")&lt;/LI-CODE&gt;</description>
      <pubDate>Sat, 12 Dec 2020 16:11:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/If-Statement-with-different-fields/m-p/532904#M8630</guid>
      <dc:creator>nickhills</dc:creator>
      <dc:date>2020-12-12T16:11:52Z</dc:date>
    </item>
    <item>
      <title>Re: If Statement with different fields</title>
      <link>https://community.splunk.com/t5/Reporting/If-Statement-with-different-fields/m-p/533527#M8638</link>
      <description>&lt;P&gt;Thanks so much for your help, would you mind explaining to me the line of code below. I am not sure what the percentages mean, and what the " " supposed to be doing. I accepted your answer for the code right below it. If you can explain this to me that would be awesome.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval cookies=(random() % 3) - 1, Stages=mvindex(split("NotReady,Ready",","),random() % 2)&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 18 Dec 2020 01:48:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/If-Statement-with-different-fields/m-p/533527#M8638</guid>
      <dc:creator>Mary666</dc:creator>
      <dc:date>2020-12-18T01:48:16Z</dc:date>
    </item>
    <item>
      <title>Re: If Statement with different fields</title>
      <link>https://community.splunk.com/t5/Reporting/If-Statement-with-different-fields/m-p/533632#M8642</link>
      <description>&lt;P&gt;This is the part where the sample data is created.&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;%&amp;nbsp;&lt;/STRONG&gt;is modulo operator(&lt;A href="https://en.wikipedia.org/wiki/Modulo_operation" target="_blank"&gt;https://en.wikipedia.org/wiki/Modulo_operation&lt;/A&gt;)&lt;/P&gt;&lt;P&gt;ref:&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Eval#Operators" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Eval#Operators&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;random() with % &lt;/STRONG&gt;creates random "modulo numbers -1".&lt;/P&gt;&lt;P&gt;ref:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/8.1.1/SearchReference/StatisticalFunctions#random.28.29" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/8.1.1/SearchReference/StatisticalFunctions#random.28.29&lt;/A&gt;&lt;/P&gt;&lt;P&gt;so,&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval cookies=(random() % 3) - 1&lt;/LI-CODE&gt;&lt;P&gt;makes cookies&amp;nbsp; -1, 0,&amp;nbsp; 1.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;random() % 2&lt;/LI-CODE&gt;&lt;P&gt;makes 0 ,1.&lt;/P&gt;&lt;P&gt;so, Stages is "NotReady" or "Ready" randomly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 19 Dec 2020 01:07:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Reporting/If-Statement-with-different-fields/m-p/533632#M8642</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-12-19T01:07:51Z</dc:date>
    </item>
  </channel>
</rss>

