<?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: mvcombine count all elements of the field in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/mvcombine-count-all-elements-of-the-field/m-p/409107#M118037</link>
    <description>&lt;P&gt;Included in the &lt;CODE&gt;Dashboard Examples&lt;/CODE&gt; app you may have noticed a token debugger tool.  This is available as a separate widget that you can add to any dashboard in the &lt;CODE&gt;Developer Gadgets&lt;/CODE&gt; app that will help a great deal debugging your problem: &lt;A href="https://splunkbase.splunk.com/app/3689/"&gt;https://splunkbase.splunk.com/app/3689/&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 01 Aug 2019 15:44:18 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2019-08-01T15:44:18Z</dc:date>
    <item>
      <title>mvcombine count all elements of the field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/mvcombine-count-all-elements-of-the-field/m-p/409098#M118028</link>
      <description>&lt;P&gt;I have a list of 5 elements:&lt;BR /&gt;
&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/7405i6CAB6F960C98C133/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;After i use &lt;CODE&gt;mvcombine&lt;/CODE&gt; i return only 1 result, but i have effectively 5 elements.&lt;BR /&gt;
&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/7406i0B5F9671F482DEA6/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;The &lt;CODE&gt;$job.resultCount$&lt;/CODE&gt; return 1, how to return 5?&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jul 2019 13:57:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/mvcombine-count-all-elements-of-the-field/m-p/409098#M118028</guid>
      <dc:creator>splunk6161</dc:creator>
      <dc:date>2019-07-29T13:57:22Z</dc:date>
    </item>
    <item>
      <title>Re: mvcombine count all elements of the field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/mvcombine-count-all-elements-of-the-field/m-p/409099#M118029</link>
      <description>&lt;P&gt;Try adding "count" to your stats function e.g.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults count=5
| eval Type="Product", ID=random()
| table ID, Type
| stats delim="; " list(ID) as ID *count* by Type
| mvcombine ID
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;then change &lt;CODE&gt;$job.resultCount$&lt;/CODE&gt; to &lt;CODE&gt;$result.count$&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;If you still want the total count (if there are multiple Types), do the count before the list e.g.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults count=5
| eval Type="Product", ID=random()
| table ID, Type
| stats *count*
| stats delim="; " list(ID) as ID by Type count
| mvcombine ID
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 29 Jul 2019 14:52:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/mvcombine-count-all-elements-of-the-field/m-p/409099#M118029</guid>
      <dc:creator>jacobpevans</dc:creator>
      <dc:date>2019-07-29T14:52:11Z</dc:date>
    </item>
    <item>
      <title>Re: mvcombine count all elements of the field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/mvcombine-count-all-elements-of-the-field/m-p/409100#M118030</link>
      <description>&lt;P&gt;The first answer work only if the column count is visible.&lt;BR /&gt;
I tried with &lt;CODE&gt;| field - count&lt;/CODE&gt; or &lt;CODE&gt;| table Type ID&lt;/CODE&gt; but &lt;CODE&gt;$result.count$&lt;/CODE&gt; doesn't work.&lt;BR /&gt;
While the second answer no result found&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jul 2019 15:42:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/mvcombine-count-all-elements-of-the-field/m-p/409100#M118030</guid>
      <dc:creator>splunk6161</dc:creator>
      <dc:date>2019-07-29T15:42:03Z</dc:date>
    </item>
    <item>
      <title>Re: mvcombine count all elements of the field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/mvcombine-count-all-elements-of-the-field/m-p/409101#M118031</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults count=5 
| eval TYPE="Protect", ID=random() 
| table ID TYPE 
| stats delim="; " count(ID) AS _count list(ID) AS ID BY TYPE 
| mvcombine ID
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This makes the &lt;CODE&gt;_count&lt;/CODE&gt; field invisible to the user but available with &lt;CODE&gt;$result._count$&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jul 2019 17:54:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/mvcombine-count-all-elements-of-the-field/m-p/409101#M118031</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-07-29T17:54:18Z</dc:date>
    </item>
    <item>
      <title>Re: mvcombine count all elements of the field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/mvcombine-count-all-elements-of-the-field/m-p/409102#M118032</link>
      <description>&lt;P&gt;edit: while this does work, I also tested @woodcock 's solution and it works and is much better than mine&lt;/P&gt;

&lt;P&gt;Copy and paste this into a new dashboard. I think it has everything you need. I separated your search into a base search where one search returns the true count and the other returns the data you want. The token is then set from the count search instead of the result search.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;dashboard&amp;gt;
  &amp;lt;label&amp;gt;Test Dashboard&amp;lt;/label&amp;gt;
  &amp;lt;search id="baseSearch"&amp;gt;
    &amp;lt;query&amp;gt;| makeresults count=5 
| eval Type="Product", ID=random()&amp;lt;/query&amp;gt;
    &amp;lt;earliest&amp;gt;-24h@m&amp;lt;/earliest&amp;gt;
    &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
  &amp;lt;/search&amp;gt;
  &amp;lt;search base="baseSearch" id="countSearch"&amp;gt;
    &amp;lt;query&amp;gt;stats count&amp;lt;/query&amp;gt;
    &amp;lt;done&amp;gt;
     &amp;lt;set token="resultCount"&amp;gt;$result.count$&amp;lt;/set&amp;gt;
    &amp;lt;/done&amp;gt;
  &amp;lt;/search&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;html&amp;gt;
      resultCount: $resultCount$
    &amp;lt;/html&amp;gt;
  &amp;lt;/row&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;table&amp;gt;
        &amp;lt;search base="baseSearch"&amp;gt;
          &amp;lt;query&amp;gt;stats delim="; " list(ID) as ID by Type 
| mvcombine ID&amp;lt;/query&amp;gt;
        &amp;lt;/search&amp;gt;
      &amp;lt;/table&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/dashboard&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 29 Jul 2019 19:05:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/mvcombine-count-all-elements-of-the-field/m-p/409102#M118032</guid>
      <dc:creator>jacobpevans</dc:creator>
      <dc:date>2019-07-29T19:05:32Z</dc:date>
    </item>
    <item>
      <title>Re: mvcombine count all elements of the field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/mvcombine-count-all-elements-of-the-field/m-p/409103#M118033</link>
      <description>&lt;P&gt;The token doesn't work, what is wrong?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;dashboard&amp;gt;
  &amp;lt;label&amp;gt;TEST_RESULTCOUNT&amp;lt;/label&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;title&amp;gt;TOTALE:$totale$&amp;lt;/title&amp;gt;
      &amp;lt;table&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;| makeresults count=5
| eval TYPE="Protect", ID=random()
| table ID TYPE
| stats delim="; " count(ID) as _count list(ID) as ID by TYPE 
| mvcombine ID&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;0&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;&amp;lt;/latest&amp;gt;
          &amp;lt;sampleRatio&amp;gt;1&amp;lt;/sampleRatio&amp;gt;
          &amp;lt;done&amp;gt;
            &amp;lt;condition&amp;gt;
              &amp;lt;set token="totale"&amp;gt;$result._count$&amp;lt;/set&amp;gt;
            &amp;lt;/condition&amp;gt;
          &amp;lt;/done&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="count"&amp;gt;100&amp;lt;/option&amp;gt;
        &amp;lt;option name="dataOverlayMode"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="percentagesRow"&amp;gt;false&amp;lt;/option&amp;gt;
        &amp;lt;option name="refresh.display"&amp;gt;progressbar&amp;lt;/option&amp;gt;
        &amp;lt;option name="rowNumbers"&amp;gt;false&amp;lt;/option&amp;gt;
        &amp;lt;option name="totalsRow"&amp;gt;false&amp;lt;/option&amp;gt;
        &amp;lt;option name="wrap"&amp;gt;true&amp;lt;/option&amp;gt;
      &amp;lt;/table&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/dashboard&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 30 Jul 2019 09:30:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/mvcombine-count-all-elements-of-the-field/m-p/409103#M118033</guid>
      <dc:creator>splunk6161</dc:creator>
      <dc:date>2019-07-30T09:30:00Z</dc:date>
    </item>
    <item>
      <title>Re: mvcombine count all elements of the field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/mvcombine-count-all-elements-of-the-field/m-p/409104#M118034</link>
      <description>&lt;P&gt;I don't get it, I do this all the time.  Install the &lt;CODE&gt;Dashboard Examples&lt;/CODE&gt; app and check out the &lt;CODE&gt;drilldown&lt;/CODE&gt; examples.  Maybe your version has a bug?&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jul 2019 05:07:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/mvcombine-count-all-elements-of-the-field/m-p/409104#M118034</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-07-31T05:07:50Z</dc:date>
    </item>
    <item>
      <title>Re: mvcombine count all elements of the field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/mvcombine-count-all-elements-of-the-field/m-p/409105#M118035</link>
      <description>&lt;P&gt;I don't known, i use 7.3.0 enterprise so i try to install &lt;CODE&gt;Dashboard Examples&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Jul 2019 11:30:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/mvcombine-count-all-elements-of-the-field/m-p/409105#M118035</guid>
      <dc:creator>splunk6161</dc:creator>
      <dc:date>2019-07-31T11:30:52Z</dc:date>
    </item>
    <item>
      <title>Re: mvcombine count all elements of the field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/mvcombine-count-all-elements-of-the-field/m-p/409106#M118036</link>
      <description>&lt;P&gt;Today I upgraded splunk to 7.3.1 but the &lt;CODE&gt;$result._count$&lt;/CODE&gt; still doesn't work.&lt;BR /&gt;
I have seen all the examples but any helped me to find the solution.&lt;BR /&gt;
I tried &lt;CODE&gt;| eval count = _count&lt;/CODE&gt; to see if the count return a result, it works!.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Aug 2019 14:21:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/mvcombine-count-all-elements-of-the-field/m-p/409106#M118036</guid>
      <dc:creator>splunk6161</dc:creator>
      <dc:date>2019-08-01T14:21:08Z</dc:date>
    </item>
    <item>
      <title>Re: mvcombine count all elements of the field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/mvcombine-count-all-elements-of-the-field/m-p/409107#M118037</link>
      <description>&lt;P&gt;Included in the &lt;CODE&gt;Dashboard Examples&lt;/CODE&gt; app you may have noticed a token debugger tool.  This is available as a separate widget that you can add to any dashboard in the &lt;CODE&gt;Developer Gadgets&lt;/CODE&gt; app that will help a great deal debugging your problem: &lt;A href="https://splunkbase.splunk.com/app/3689/"&gt;https://splunkbase.splunk.com/app/3689/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Aug 2019 15:44:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/mvcombine-count-all-elements-of-the-field/m-p/409107#M118037</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-08-01T15:44:18Z</dc:date>
    </item>
  </channel>
</rss>

