<?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 satisfy stat count by eval1 else stat count by eval2 in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/if-satisfy-stat-count-by-eval1-else-stat-count-by-eval2/m-p/460338#M129883</link>
    <description>&lt;P&gt;This will be far easier if we know what your data looks like, so can you supply a couple of events for us to look at?&lt;/P&gt;

&lt;P&gt;Please use the code button to paste them (101010).&lt;/P&gt;</description>
    <pubDate>Fri, 27 Mar 2020 13:00:52 GMT</pubDate>
    <dc:creator>Richfez</dc:creator>
    <dc:date>2020-03-27T13:00:52Z</dc:date>
    <item>
      <title>if satisfy stat count by eval1 else stat count by eval2</title>
      <link>https://community.splunk.com/t5/Splunk-Search/if-satisfy-stat-count-by-eval1-else-stat-count-by-eval2/m-p/460335#M129880</link>
      <description>&lt;P&gt;Hi bro, I have a problem with display next version to compare with current version selected&lt;BR /&gt;
The code bellow is work, but when i selected the lastest version i can not handle null value in VERSION&lt;BR /&gt;
I want VERSION will stats count from version_0 (All value excepted current value select) when i select lasted version&lt;BR /&gt;
How can i display it, appricate thanks for any help !&lt;/P&gt;

&lt;P&gt;index=abcd MODEL IN ($model$) BUILDTYPE=$buildtype$ source="&lt;EM&gt;source1&lt;/EM&gt;"&lt;BR /&gt;
| search VERSION&amp;gt; $version$&lt;BR /&gt;
| stats count by VERSION&lt;/P&gt;

&lt;P&gt;i try the bellow code but it didnt work due to null value in temp will replaced&lt;BR /&gt;
index=abcd MODEL IN ($model$) BUILDTYPE=$buildtype$ source="&lt;EM&gt;source1&lt;/EM&gt;"&lt;BR /&gt;
| eval version = VERSION&lt;BR /&gt;
| eval temp = if(version &amp;gt; $version$, VERSION, null)&lt;BR /&gt;
| eval temp1 = if(isnull(temp), mvindex(VERSION,1) , temp)&lt;BR /&gt;
| stats count by temp1&lt;/P&gt;</description>
      <pubDate>Fri, 27 Mar 2020 03:44:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/if-satisfy-stat-count-by-eval1-else-stat-count-by-eval2/m-p/460335#M129880</guid>
      <dc:creator>akira2211</dc:creator>
      <dc:date>2020-03-27T03:44:03Z</dc:date>
    </item>
    <item>
      <title>Re: if satisfy stat count by eval1 else stat count by eval2</title>
      <link>https://community.splunk.com/t5/Splunk-Search/if-satisfy-stat-count-by-eval1-else-stat-count-by-eval2/m-p/460336#M129881</link>
      <description>&lt;P&gt;You very well may be able to just do a &lt;/P&gt;

&lt;P&gt;index=abcd MODEL IN ($model$) BUILDTYPE=$buildtype$ source="source1" &lt;BR /&gt;
| search VERSION&amp;gt; $version$&lt;BR /&gt;
| fillnull VERSION value=0&lt;BR /&gt;
| stats count by VERSION&lt;/P&gt;

&lt;P&gt;Replace "value=0" with some other value as appropriate.&lt;/P&gt;</description>
      <pubDate>Fri, 27 Mar 2020 04:32:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/if-satisfy-stat-count-by-eval1-else-stat-count-by-eval2/m-p/460336#M129881</guid>
      <dc:creator>Richfez</dc:creator>
      <dc:date>2020-03-27T04:32:12Z</dc:date>
    </item>
    <item>
      <title>Re: if satisfy stat count by eval1 else stat count by eval2</title>
      <link>https://community.splunk.com/t5/Splunk-Search/if-satisfy-stat-count-by-eval1-else-stat-count-by-eval2/m-p/460337#M129882</link>
      <description>&lt;P&gt;Hi. thanks for your help but it doesn't work.&lt;BR /&gt;
In details:&lt;BR /&gt;
In Version i have [1,2,3,4,5]&lt;BR /&gt;
If my $version$ = 3, so, my result will be&lt;BR /&gt;
VERSION&lt;BR /&gt;
     4&lt;BR /&gt;
     5&lt;BR /&gt;
but if $version$ = 5. It will return nothing&lt;BR /&gt;
Expect out put as i hope:&lt;BR /&gt;
VERSION&lt;BR /&gt;&lt;BR /&gt;
      1&lt;BR /&gt;&lt;BR /&gt;
      2&lt;BR /&gt;&lt;BR /&gt;
      3&lt;BR /&gt;&lt;BR /&gt;
      4&lt;BR /&gt;&lt;BR /&gt;
OR&lt;BR /&gt;
VERSION&lt;BR /&gt;
       4&lt;BR /&gt;
       3&lt;BR /&gt;
       2&lt;BR /&gt;
       1&lt;/P&gt;</description>
      <pubDate>Fri, 27 Mar 2020 05:10:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/if-satisfy-stat-count-by-eval1-else-stat-count-by-eval2/m-p/460337#M129882</guid>
      <dc:creator>akira2211</dc:creator>
      <dc:date>2020-03-27T05:10:48Z</dc:date>
    </item>
    <item>
      <title>Re: if satisfy stat count by eval1 else stat count by eval2</title>
      <link>https://community.splunk.com/t5/Splunk-Search/if-satisfy-stat-count-by-eval1-else-stat-count-by-eval2/m-p/460338#M129883</link>
      <description>&lt;P&gt;This will be far easier if we know what your data looks like, so can you supply a couple of events for us to look at?&lt;/P&gt;

&lt;P&gt;Please use the code button to paste them (101010).&lt;/P&gt;</description>
      <pubDate>Fri, 27 Mar 2020 13:00:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/if-satisfy-stat-count-by-eval1-else-stat-count-by-eval2/m-p/460338#M129883</guid>
      <dc:creator>Richfez</dc:creator>
      <dc:date>2020-03-27T13:00:52Z</dc:date>
    </item>
    <item>
      <title>Re: if satisfy stat count by eval1 else stat count by eval2</title>
      <link>https://community.splunk.com/t5/Splunk-Search/if-satisfy-stat-count-by-eval1-else-stat-count-by-eval2/m-p/460339#M129884</link>
      <description>&lt;P&gt;What do you expect the output to be when &lt;CODE&gt;$version$ = 5&lt;/CODE&gt;?&lt;/P&gt;</description>
      <pubDate>Fri, 27 Mar 2020 13:15:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/if-satisfy-stat-count-by-eval1-else-stat-count-by-eval2/m-p/460339#M129884</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2020-03-27T13:15:20Z</dc:date>
    </item>
    <item>
      <title>Re: if satisfy stat count by eval1 else stat count by eval2</title>
      <link>https://community.splunk.com/t5/Splunk-Search/if-satisfy-stat-count-by-eval1-else-stat-count-by-eval2/m-p/460340#M129885</link>
      <description>&lt;P&gt;This is data table example&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Model             BuildType         Version
    A               type1                1
    A               type2                2
    A               type1                3
    B               type1                4
    B               type2                5
    B               type1                6
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I have 2 panel. &lt;BR /&gt;
Left is panel with version i select from chart.&lt;BR /&gt;&lt;BR /&gt;
Right panel is version choise ($version$) with default is next $version$&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=abcd MODEL IN ($model$) BUILDTYPE=$buildtype$ source="source1"
| search VERSION&amp;gt; $version$
| stats count by VERSION
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In the above code. When i click on version 3 in chart. I have left panel is version 3. And right will be 4 (Dropdown list with value is 4, 5, 6 . But 4 will be selected)&lt;BR /&gt;
However, when i choise the lastest version. Example i click on version 6 on chart ($version$ = 6 )&lt;BR /&gt;
The left panel now will select version = 6. Right panel is no result found ( Null ) now.&lt;BR /&gt;
The output i expect as bellow&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Left Panel                    Right Panel

Version                     Version
   6                              5
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This is dropdown list so we also can choice Version in Right to 4,3,2,1&lt;/P&gt;</description>
      <pubDate>Fri, 27 Mar 2020 15:27:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/if-satisfy-stat-count-by-eval1-else-stat-count-by-eval2/m-p/460340#M129885</guid>
      <dc:creator>akira2211</dc:creator>
      <dc:date>2020-03-27T15:27:44Z</dc:date>
    </item>
  </channel>
</rss>

