<?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: Count selected items in Multiselect in Splunk Enterprise</title>
    <link>https://community.splunk.com/t5/Splunk-Enterprise/Count-selected-items-in-Multiselect/m-p/691084#M19643</link>
    <description>&lt;P&gt;Try something like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval selected_total = mvcount($form.element$)&lt;/LI-CODE&gt;</description>
    <pubDate>Wed, 19 Jun 2024 11:37:35 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2024-06-19T11:37:35Z</dc:date>
    <item>
      <title>Count selected items in Multiselect</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Count-selected-items-in-Multiselect/m-p/691080#M19642</link>
      <description>&lt;P&gt;Hi all&lt;/P&gt;&lt;P&gt;I'm trying to count the number of selected items in a Multiselect control. I've tried eval and stats but no luck with either &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval selected_total = count($element$)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| stats count($element$) as selected_total&lt;/LI-CODE&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;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2024 11:46:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Count-selected-items-in-Multiselect/m-p/691080#M19642</guid>
      <dc:creator>dataisbeautiful</dc:creator>
      <dc:date>2024-06-19T11:46:37Z</dc:date>
    </item>
    <item>
      <title>Re: Count selected items in Multiselect</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Count-selected-items-in-Multiselect/m-p/691084#M19643</link>
      <description>&lt;P&gt;Try something like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval selected_total = mvcount($form.element$)&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 19 Jun 2024 11:37:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Count-selected-items-in-Multiselect/m-p/691084#M19643</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-06-19T11:37:35Z</dc:date>
    </item>
    <item>
      <title>Re: Count selected items in Multiselect</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Count-selected-items-in-Multiselect/m-p/691088#M19644</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That didn't work unfortunately, gave the following error&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Set token value to render visualization
$form.element$&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2024 11:46:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Count-selected-items-in-Multiselect/m-p/691088#M19644</guid>
      <dc:creator>dataisbeautiful</dc:creator>
      <dc:date>2024-06-19T11:46:15Z</dc:date>
    </item>
    <item>
      <title>Re: Count selected items in Multiselect</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Count-selected-items-in-Multiselect/m-p/691089#M19645</link>
      <description>&lt;P&gt;Please provide more information such as the source of your dashboard&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jun 2024 11:56:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Count-selected-items-in-Multiselect/m-p/691089#M19645</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-06-19T11:56:54Z</dc:date>
    </item>
    <item>
      <title>Re: Count selected items in Multiselect</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Count-selected-items-in-Multiselect/m-p/691178#M19652</link>
      <description>&lt;P&gt;Sample dashboard&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{
    "visualizations": {
        "viz_3hKq7uoX": {
            "type": "splunk.singlevalue",
            "options": {},
            "dataSources": {
                "primary": "ds_a2mWNgri"
            }
        },
        "viz_JUFcFWVl": {
            "type": "splunk.singlevalue",
            "options": {},
            "dataSources": {
                "primary": "ds_LbaP4o2H"
            }
        }
    },
    "dataSources": {
        "ds_a2mWNgri": {
            "type": "ds.search",
            "options": {
                "query": "| makeresults\n| eval selected_total = count($element$)\n| table selected_total"
            },
            "name": "Search_eval"
        },
        "ds_LbaP4o2H": {
            "type": "ds.search",
            "options": {
                "query": "| makeresults\n| stats count($element$) as selected_total\n| table selected_total"
            },
            "name": "Search_stats"
        }
    },
    "defaults": {
        "dataSources": {
            "ds.search": {
                "options": {
                    "queryParameters": {
                        "latest": "$global_time.latest$",
                        "earliest": "$global_time.earliest$"
                    }
                }
            }
        }
    },
    "inputs": {
        "input_global_trp": {
            "type": "input.timerange",
            "options": {
                "token": "global_time",
                "defaultValue": "-24h@h,now"
            },
            "title": "Global Time Range"
        },
        "input_QDGCxYVt": {
            "options": {
                "items": [
                    {
                        "label": "Apple",
                        "value": "a"
                    },
                    {
                        "label": "Banana",
                        "value": "b"
                    },
                    {
                        "label": "Coconut",
                        "value": "c"
                    },
                    {
                        "label": "Dragonfruit",
                        "value": "d"
                    },
                    {
                        "label": "Elderberry",
                        "value": "e"
                    },
                    {
                        "label": "Fig",
                        "value": "f"
                    },
                    {
                        "label": "Grape",
                        "value": "g"
                    }
                ],
                "token": "element"
            },
            "title": "Select something",
            "type": "input.multiselect"
        }
    },
    "layout": {
        "type": "absolute",
        "options": {
            "width": 1440,
            "height": 960,
            "display": "auto"
        },
        "structure": [
            {
                "item": "viz_3hKq7uoX",
                "type": "block",
                "position": {
                    "x": 20,
                    "y": 20,
                    "w": 250,
                    "h": 250
                }
            },
            {
                "item": "viz_JUFcFWVl",
                "type": "block",
                "position": {
                    "x": 290,
                    "y": 20,
                    "w": 250,
                    "h": 250
                }
            }
        ],
        "globalInputs": [
            "input_global_trp",
            "input_QDGCxYVt"
        ]
    },
    "description": "test",
    "title": "test"
}&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 20 Jun 2024 13:28:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Count-selected-items-in-Multiselect/m-p/691178#M19652</guid>
      <dc:creator>dataisbeautiful</dc:creator>
      <dc:date>2024-06-20T13:28:45Z</dc:date>
    </item>
    <item>
      <title>Re: Count selected items in Multiselect</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Count-selected-items-in-Multiselect/m-p/691193#M19656</link>
      <description>&lt;P&gt;Can you build your dashboard in SimpleXML / Classic (as token management is a little better there)?&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jun 2024 17:01:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Count-selected-items-in-Multiselect/m-p/691193#M19656</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-06-20T17:01:45Z</dc:date>
    </item>
    <item>
      <title>Re: Count selected items in Multiselect</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Count-selected-items-in-Multiselect/m-p/691446#M19679</link>
      <description>&lt;P&gt;Here's a sample in classic, still can't figure out how to count the number of selected items.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;form version="1.1" theme="light"&amp;gt;
  &amp;lt;label&amp;gt;test2&amp;lt;/label&amp;gt;
  &amp;lt;fieldset submitButton="false"&amp;gt;
    &amp;lt;input type="multiselect" token="element" searchWhenChanged="true"&amp;gt;
      &amp;lt;label&amp;gt;Fruit Select&amp;lt;/label&amp;gt;
      &amp;lt;choice value="a"&amp;gt;Apple&amp;lt;/choice&amp;gt;
      &amp;lt;choice value="b"&amp;gt;Banana&amp;lt;/choice&amp;gt;
      &amp;lt;choice value="c"&amp;gt;Coconut&amp;lt;/choice&amp;gt;
      &amp;lt;choice value="d"&amp;gt;Dragonfruit&amp;lt;/choice&amp;gt;
      &amp;lt;choice value="e"&amp;gt;Elderberry&amp;lt;/choice&amp;gt;
      &amp;lt;choice value="f"&amp;gt;Fig&amp;lt;/choice&amp;gt;
      &amp;lt;choice value="g"&amp;gt;Grape&amp;lt;/choice&amp;gt;
    &amp;lt;/input&amp;gt;
  &amp;lt;/fieldset&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;single&amp;gt;
        &amp;lt;title&amp;gt;Number of selected fruit&amp;lt;/title&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;| makeresults
| stats count($element$) as selected_total
| table selected_total&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;-24h@h&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="rangeColors"&amp;gt;["0x53a051","0x0877a6","0xf8be34","0xf1813f","0xdc4e41"]&amp;lt;/option&amp;gt;
        &amp;lt;option name="refresh.display"&amp;gt;progressbar&amp;lt;/option&amp;gt;
      &amp;lt;/single&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/form&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jun 2024 13:19:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Count-selected-items-in-Multiselect/m-p/691446#M19679</guid>
      <dc:creator>dataisbeautiful</dc:creator>
      <dc:date>2024-06-24T13:19:50Z</dc:date>
    </item>
    <item>
      <title>Re: Count selected items in Multiselect</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Count-selected-items-in-Multiselect/m-p/691488#M19682</link>
      <description>&lt;P&gt;As&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;, you should use $form.element$ - the $form.element$ variant of the token is the one that holds the values of the selections, whereas the base $element$ holds the final full expanded token with all the prefixes, suffixed and delimiter, see your slightly modified example.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;form version="1.1" theme="light"&amp;gt;
  &amp;lt;label&amp;gt;test2&amp;lt;/label&amp;gt;
  &amp;lt;fieldset submitButton="false"&amp;gt;
    &amp;lt;input type="multiselect" token="element" searchWhenChanged="true"&amp;gt;
      &amp;lt;label&amp;gt;Fruit Select&amp;lt;/label&amp;gt;
      &amp;lt;choice value="a"&amp;gt;Apple&amp;lt;/choice&amp;gt;
      &amp;lt;choice value="b"&amp;gt;Banana&amp;lt;/choice&amp;gt;
      &amp;lt;choice value="c"&amp;gt;Coconut&amp;lt;/choice&amp;gt;
      &amp;lt;choice value="d"&amp;gt;Dragonfruit&amp;lt;/choice&amp;gt;
      &amp;lt;choice value="e"&amp;gt;Elderberry&amp;lt;/choice&amp;gt;
      &amp;lt;choice value="f"&amp;gt;Fig&amp;lt;/choice&amp;gt;
      &amp;lt;choice value="g"&amp;gt;Grape&amp;lt;/choice&amp;gt;
      &amp;lt;prefix&amp;gt;(&amp;lt;/prefix&amp;gt;
      &amp;lt;suffix&amp;gt;)&amp;lt;/suffix&amp;gt;
      &amp;lt;valuePrefix&amp;gt;"&amp;lt;/valuePrefix&amp;gt;
      &amp;lt;valueSuffix&amp;gt;"&amp;lt;/valueSuffix&amp;gt;
      &amp;lt;delimiter&amp;gt;, &amp;lt;/delimiter&amp;gt;
    &amp;lt;/input&amp;gt;
  &amp;lt;/fieldset&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;title&amp;gt;Form element::$form.element$, Element::$element$&amp;lt;/title&amp;gt;
      &amp;lt;single&amp;gt;
        &amp;lt;title&amp;gt;Number of selected fruit&amp;lt;/title&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;| makeresults
          | eval selected_total=mvcount(split($form.element|s$,","))
| table selected_total&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;-24h@h&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="rangeColors"&amp;gt;["0x53a051","0x0877a6","0xf8be34","0xf1813f","0xdc4e41"]&amp;lt;/option&amp;gt;
        &amp;lt;option name="refresh.display"&amp;gt;progressbar&amp;lt;/option&amp;gt;
      &amp;lt;/single&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/form&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;I am not sure if the&lt;STRONG&gt;| eval selected_total=mvcount(split($form.element|s$,","))&lt;/STRONG&gt; would work also in dashboard studio also.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jun 2024 00:49:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Count-selected-items-in-Multiselect/m-p/691488#M19682</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2024-06-25T00:49:12Z</dc:date>
    </item>
    <item>
      <title>Re: Count selected items in Multiselect</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Count-selected-items-in-Multiselect/m-p/691489#M19683</link>
      <description>&lt;P&gt;And you can also add a&amp;nbsp;&lt;STRONG&gt;&amp;lt;change&amp;gt;&amp;nbsp;&lt;/STRONG&gt;element in the multiselect, which although officially unsupported, does work, i.e. this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;      &amp;lt;change&amp;gt;
        &amp;lt;eval token="selections"&amp;gt;mvcount($form.element$)&amp;lt;/eval&amp;gt;
      &amp;lt;/change&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;Note that you don't need the split here as the $form.element$ is only flattened in the token assignment in the SPL&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jun 2024 02:06:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Count-selected-items-in-Multiselect/m-p/691489#M19683</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2024-06-25T02:06:38Z</dc:date>
    </item>
    <item>
      <title>Re: Count selected items in Multiselect</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Count-selected-items-in-Multiselect/m-p/691515#M19686</link>
      <description>&lt;P&gt;Thanks &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/6367"&gt;@bowesmana&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jun 2024 07:26:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Count-selected-items-in-Multiselect/m-p/691515#M19686</guid>
      <dc:creator>dataisbeautiful</dc:creator>
      <dc:date>2024-06-25T07:26:24Z</dc:date>
    </item>
  </channel>
</rss>

