<?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: Usage of multiple labels in a multivalue field input? in Splunk Enterprise</title>
    <link>https://community.splunk.com/t5/Splunk-Enterprise/Usage-of-multiple-labels-in-a-multivalue-field-input/m-p/633508#M15609</link>
    <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/170645"&gt;@danspav&lt;/a&gt;&amp;nbsp;Dan, the official docs for multiselect still say that &amp;lt;change&amp;gt; and &amp;lt;condition&amp;gt; are not supported for multiselect inputs&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/Viz/PanelreferenceforSimplifiedXML#input_.28form.29" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/latest/Viz/PanelreferenceforSimplifiedXML#input_.28form.29&lt;/A&gt;&lt;/P&gt;&lt;P&gt;My experience in the past is that is seems to partially work, but that was some time ago and it clearly works in your example - are you aware of any restrictions in multiselects?&lt;/P&gt;</description>
    <pubDate>Mon, 06 Mar 2023 23:31:14 GMT</pubDate>
    <dc:creator>bowesmana</dc:creator>
    <dc:date>2023-03-06T23:31:14Z</dc:date>
    <item>
      <title>Usage of multiple labels in a multivalue field input?</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Usage-of-multiple-labels-in-a-multivalue-field-input/m-p/633438#M15599</link>
      <description>&lt;P&gt;Hello fellow Splunk developers,&lt;/P&gt;
&lt;P&gt;I need to use the selected labels from a multi value input in form of a token.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For a better explanation I created a short mock-up.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;&amp;lt;form&amp;gt;
  &amp;lt;label&amp;gt;Test&amp;lt;/label&amp;gt;
  &amp;lt;fieldset submitButton="false" autoRun="true"&amp;gt;
   &amp;lt;input type="multiselect" token="input" searchWhenChanged="true"&amp;gt;
      &amp;lt;choice value="A"&amp;gt;1&amp;lt;/choice&amp;gt;
      &amp;lt;choice value="B"&amp;gt;2&amp;lt;/choice&amp;gt;
      &amp;lt;choice value="C"&amp;gt;3&amp;lt;/choice&amp;gt;
      &amp;lt;change&amp;gt;
        &amp;lt;set token="selectedLabel"&amp;gt;$label$&amp;lt;/set&amp;gt;
        &amp;lt;set token="selectedValue"&amp;gt;$input$&amp;lt;/set&amp;gt;
      &amp;lt;/change&amp;gt; 
    &amp;lt;/input&amp;gt;
    &amp;lt;input type="radio" searchWhenChanged="true"&amp;gt;
      &amp;lt;label&amp;gt;$selectedLabel$&amp;lt;/label&amp;gt;
    &amp;lt;/input&amp;gt;
    &amp;lt;input type="radio" searchWhenChanged="true"&amp;gt;
      &amp;lt;label&amp;gt;$selectedValue$&amp;lt;/label&amp;gt;
    &amp;lt;/input&amp;gt;
  &amp;lt;/fieldset&amp;gt;
&amp;lt;/form&amp;gt;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If now multiple values are selected the "selectedValue" token contains all the values selected, however the "selectedLabel" token only contains the first value selected as it can be seen in the picture below.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="multiValueField.PNG" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/24209iD8C20E7AF535C14B/image-size/large?v=v2&amp;amp;px=999" role="button" title="multiValueField.PNG" alt="multiValueField.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is this a bug or the intended behavior? Is there a way how to store all labels inside a token?&amp;nbsp;&lt;BR /&gt;Please note that the radio buttons serve only the purpose to show the token values in their label fields.&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>Mon, 06 Mar 2023 15:01:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Usage-of-multiple-labels-in-a-multivalue-field-input/m-p/633438#M15599</guid>
      <dc:creator>DaDave</dc:creator>
      <dc:date>2023-03-06T15:01:36Z</dc:date>
    </item>
    <item>
      <title>Re: Usage of multiple labels in a multivalue field input?</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Usage-of-multiple-labels-in-a-multivalue-field-input/m-p/633502#M15608</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/254314"&gt;@DaDave&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Here's a way to get the labels and values tokens in a multiselect.&lt;/P&gt;&lt;P&gt;We will encode the key/values into the value field, and use conditional tags to extract the keys for the keys token and the values for the values token.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="2023-03-07 09_55_32-Test _ Splunk 9.0.0.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/24218i45D627D547126261/image-size/medium?v=v2&amp;amp;px=400" role="button" title="2023-03-07 09_55_32-Test _ Splunk 9.0.0.png" alt="2023-03-07 09_55_32-Test _ Splunk 9.0.0.png" /&gt;&lt;/span&gt;Here's the dashboard code:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;form version="1.1"&amp;gt;
  &amp;lt;label&amp;gt;Test&amp;lt;/label&amp;gt;
  &amp;lt;fieldset submitButton="false" autoRun="true"&amp;gt;
    &amp;lt;input type="multiselect" token="input" searchWhenChanged="true"&amp;gt;
      &amp;lt;choice value="A|1"&amp;gt;1&amp;lt;/choice&amp;gt;
      &amp;lt;choice value="B|2"&amp;gt;2&amp;lt;/choice&amp;gt;
      &amp;lt;choice value="C|3"&amp;gt;3&amp;lt;/choice&amp;gt;
      &amp;lt;change&amp;gt;
        &amp;lt;condition match="isnull($input$)"&amp;gt;
          &amp;lt;unset token="selectedLabel"&amp;gt;&amp;lt;/unset&amp;gt;
          &amp;lt;unset token="selectedValue"&amp;gt;&amp;lt;/unset&amp;gt;
        &amp;lt;/condition&amp;gt;
        &amp;lt;condition&amp;gt;
        &amp;lt;eval token="selectedLabel"&amp;gt;replace($input$,"[a-zA-Z][|]","")&amp;lt;/eval&amp;gt;
        &amp;lt;eval token="selectedValue"&amp;gt;replace($input$,"[|][0-9]","")&amp;lt;/eval&amp;gt;
        &amp;lt;/condition&amp;gt;
      &amp;lt;/change&amp;gt;
    &amp;lt;/input&amp;gt;
    &amp;lt;input type="radio" searchWhenChanged="true"&amp;gt;
      &amp;lt;label&amp;gt;$selectedLabel$&amp;lt;/label&amp;gt;
    &amp;lt;/input&amp;gt;
    &amp;lt;input type="radio" searchWhenChanged="true"&amp;gt;
      &amp;lt;label&amp;gt;$selectedValue$&amp;lt;/label&amp;gt;
    &amp;lt;/input&amp;gt;
   &amp;lt;/fieldset&amp;gt;
  &amp;lt;row&amp;gt;&amp;lt;html&amp;gt;
    &amp;lt;table border="1"&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;th&amp;gt;Value&amp;lt;/th&amp;gt;&amp;lt;th&amp;gt;Label&amp;lt;/th&amp;gt;&amp;lt;/tr&amp;gt;
    &amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;$selectedValue$&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;$selectedLabel$&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;/table&amp;gt;
  &amp;lt;/html&amp;gt;&amp;lt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've updated the values in the multiselect to be in the format: value|key&lt;/P&gt;&lt;P&gt;Then when the multiselect changes we extract everything before the | for the value, and everything after the | for the key.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;The replace regex will be a bit more complicated when you use actual data - but the general solution should work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Spav&lt;/P&gt;</description>
      <pubDate>Mon, 06 Mar 2023 22:59:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Usage-of-multiple-labels-in-a-multivalue-field-input/m-p/633502#M15608</guid>
      <dc:creator>danspav</dc:creator>
      <dc:date>2023-03-06T22:59:58Z</dc:date>
    </item>
    <item>
      <title>Re: Usage of multiple labels in a multivalue field input?</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Usage-of-multiple-labels-in-a-multivalue-field-input/m-p/633508#M15609</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/170645"&gt;@danspav&lt;/a&gt;&amp;nbsp;Dan, the official docs for multiselect still say that &amp;lt;change&amp;gt; and &amp;lt;condition&amp;gt; are not supported for multiselect inputs&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/Viz/PanelreferenceforSimplifiedXML#input_.28form.29" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/latest/Viz/PanelreferenceforSimplifiedXML#input_.28form.29&lt;/A&gt;&lt;/P&gt;&lt;P&gt;My experience in the past is that is seems to partially work, but that was some time ago and it clearly works in your example - are you aware of any restrictions in multiselects?&lt;/P&gt;</description>
      <pubDate>Mon, 06 Mar 2023 23:31:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Usage-of-multiple-labels-in-a-multivalue-field-input/m-p/633508#M15609</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2023-03-06T23:31:14Z</dc:date>
    </item>
    <item>
      <title>Re: Usage of multiple labels in a multivalue field input?</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Usage-of-multiple-labels-in-a-multivalue-field-input/m-p/633512#M15610</link>
      <description>&lt;P&gt;Good pickup.&lt;/P&gt;&lt;P&gt;If the token prefix/suffix and field prefix/suffix are used, then the values will get a bit complex, but I haven't yet run into a situation where I couldn't use &amp;lt;change&amp;gt;.&lt;/P&gt;&lt;P&gt;However, seeing how it's unsupported,&amp;nbsp; if you want to avoid using change then you'd need to rely on JavaScript to manipulate the $label$ token.&lt;/P&gt;&lt;P&gt;Something like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var defaultTokenModel = mvc.Components.get("default");
defaultTokenModel.on("change:input", function(key, value) {
    ...
        // Update the $newLabel$ token value
        defaultTokenModel.set('labels', newLabel);
    });&lt;/LI-CODE&gt;&lt;P&gt;See Splunk Dev docs for more info:&lt;/P&gt;&lt;P&gt;&lt;A title="Splunk Dev Docs. " href="https://dev.splunk.com/enterprise/docs/developapps/visualizedata/simplexmlextensions/tokenmanipulation/" target="_self"&gt;https://dev.splunk.com/enterprise/docs/developapps/visualizedata/simplexmlextensions/tokenmanipulation/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Mar 2023 23:43:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Usage-of-multiple-labels-in-a-multivalue-field-input/m-p/633512#M15610</guid>
      <dc:creator>danspav</dc:creator>
      <dc:date>2023-03-06T23:43:04Z</dc:date>
    </item>
  </channel>
</rss>

