<?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 Change &amp;amp; Condition within a multiselect with token in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Change-amp-Condition-within-a-multiselect-with-token/m-p/553031#M38331</link>
    <description>&lt;P&gt;The first change condition is working fine but the second one I have where I setting a token with a different value is not.&lt;/P&gt;&lt;P&gt;What I want to do is to change the search query when the value is "All". And when the value has categories add the where to the query&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me show what I have:&lt;BR /&gt;&lt;BR /&gt;&amp;lt;input type="multiselect" token="categories" searchWhenChanged="false"&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;lt;label&amp;gt;Select Categories&amp;lt;/label&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;lt;fieldForLabel&amp;gt;category&amp;lt;/fieldForLabel&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;lt;fieldForValue&amp;gt;category&amp;lt;/fieldForValue&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;lt;search&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;query&amp;gt;index=abc &amp;nbsp;"allcategories"&amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;lt;/search&amp;gt;&lt;BR /&gt;&amp;lt;valuePrefix&amp;gt;"&amp;lt;/valuePrefix&amp;gt;&lt;BR /&gt;&amp;lt;choice value="*"&amp;gt;All&amp;lt;/choice&amp;gt;&lt;BR /&gt;&amp;lt;change&amp;gt;&lt;BR /&gt;&amp;lt;condition value="*"&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;lt;set token="search_filter1"&amp;gt;index=abc &amp;lt;/set&amp;gt;&lt;BR /&gt;&amp;lt;/condition&amp;gt;&lt;BR /&gt;&amp;lt;condition&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;lt;set token="search_filter1"&amp;gt;index=abc&amp;nbsp;&amp;nbsp;| where category IN ($categories$)&amp;lt;/set&amp;gt;&lt;BR /&gt;&amp;lt;/condition&amp;gt;&lt;BR /&gt;&amp;lt;/change&amp;gt;&lt;BR /&gt;&amp;lt;/input&amp;gt;&lt;/P&gt;&lt;P&gt;Then I have a panel like this&lt;/P&gt;&lt;P&gt;&amp;lt;panel&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;lt;title&amp;gt;Panel by categories&amp;lt;/title&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;lt;table&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;search&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;query&amp;gt;$search_filter1$ | stats count by category&amp;lt;/query&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/search&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;lt;/table&amp;gt;&lt;BR /&gt;&amp;lt;/panel&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 25 May 2021 22:22:51 GMT</pubDate>
    <dc:creator>jmorenog</dc:creator>
    <dc:date>2021-05-25T22:22:51Z</dc:date>
    <item>
      <title>Change &amp; Condition within a multiselect with token</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Change-amp-Condition-within-a-multiselect-with-token/m-p/553031#M38331</link>
      <description>&lt;P&gt;The first change condition is working fine but the second one I have where I setting a token with a different value is not.&lt;/P&gt;&lt;P&gt;What I want to do is to change the search query when the value is "All". And when the value has categories add the where to the query&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me show what I have:&lt;BR /&gt;&lt;BR /&gt;&amp;lt;input type="multiselect" token="categories" searchWhenChanged="false"&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;lt;label&amp;gt;Select Categories&amp;lt;/label&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;lt;fieldForLabel&amp;gt;category&amp;lt;/fieldForLabel&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;lt;fieldForValue&amp;gt;category&amp;lt;/fieldForValue&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;lt;search&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;query&amp;gt;index=abc &amp;nbsp;"allcategories"&amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;lt;/search&amp;gt;&lt;BR /&gt;&amp;lt;valuePrefix&amp;gt;"&amp;lt;/valuePrefix&amp;gt;&lt;BR /&gt;&amp;lt;choice value="*"&amp;gt;All&amp;lt;/choice&amp;gt;&lt;BR /&gt;&amp;lt;change&amp;gt;&lt;BR /&gt;&amp;lt;condition value="*"&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;lt;set token="search_filter1"&amp;gt;index=abc &amp;lt;/set&amp;gt;&lt;BR /&gt;&amp;lt;/condition&amp;gt;&lt;BR /&gt;&amp;lt;condition&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;lt;set token="search_filter1"&amp;gt;index=abc&amp;nbsp;&amp;nbsp;| where category IN ($categories$)&amp;lt;/set&amp;gt;&lt;BR /&gt;&amp;lt;/condition&amp;gt;&lt;BR /&gt;&amp;lt;/change&amp;gt;&lt;BR /&gt;&amp;lt;/input&amp;gt;&lt;/P&gt;&lt;P&gt;Then I have a panel like this&lt;/P&gt;&lt;P&gt;&amp;lt;panel&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;lt;title&amp;gt;Panel by categories&amp;lt;/title&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;lt;table&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;search&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;query&amp;gt;$search_filter1$ | stats count by category&amp;lt;/query&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/search&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;lt;/table&amp;gt;&lt;BR /&gt;&amp;lt;/panel&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 May 2021 22:22:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Change-amp-Condition-within-a-multiselect-with-token/m-p/553031#M38331</guid>
      <dc:creator>jmorenog</dc:creator>
      <dc:date>2021-05-25T22:22:51Z</dc:date>
    </item>
    <item>
      <title>Re: Change &amp; Condition within a multiselect with token</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Change-amp-Condition-within-a-multiselect-with-token/m-p/553034#M38332</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/234796"&gt;@jmorenog&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;lt;change&amp;gt; is not officially supported for multiselect inputs, see&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/Splunk/8.1.4/Viz/PanelreferenceforSimplifiedXML#input_.28form.29" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/8.1.4/Viz/PanelreferenceforSimplifiedXML#input_.28form.29&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I am not sure what will happen with &amp;lt;change&amp;gt; in that context, but your definition of the multiselect only has a valuePrefix, no suffix, delimeter or token prefix/suffix, so not sure what $categories$ will represent when you add/remove options.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 May 2021 22:52:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Change-amp-Condition-within-a-multiselect-with-token/m-p/553034#M38332</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2021-05-25T22:52:48Z</dc:date>
    </item>
    <item>
      <title>Re: Change &amp; Condition within a multiselect with token</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Change-amp-Condition-within-a-multiselect-with-token/m-p/553082#M38346</link>
      <description>&lt;P&gt;Thanks for your answer&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/6367"&gt;@bowesmana&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ohh I didn't know change is not support for multiselect. Thanks&lt;/P&gt;&lt;P&gt;I forgot to add those values but here they go:&lt;/P&gt;&lt;P&gt;&amp;lt;valuePrefix&amp;gt;"&amp;lt;/valuePrefix&amp;gt;&lt;BR /&gt;&amp;lt;valueSuffix&amp;gt;"&amp;lt;/valueSuffix&amp;gt;&lt;BR /&gt;&amp;lt;delimiter&amp;gt; ,&amp;lt;/delimiter&amp;gt;&lt;/P&gt;&lt;P&gt;There are 4 categories: A, B, C, D in the multiselect. If there are categories selected in the input, I want to add to the query "| where category IN ($categories$)". But if is "All" I don't want that statement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 May 2021 08:16:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Change-amp-Condition-within-a-multiselect-with-token/m-p/553082#M38346</guid>
      <dc:creator>jmorenog</dc:creator>
      <dc:date>2021-05-26T08:16:26Z</dc:date>
    </item>
    <item>
      <title>Re: Change &amp; Condition within a multiselect with token</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Change-amp-Condition-within-a-multiselect-with-token/m-p/553105#M38353</link>
      <description>&lt;P&gt;You could do something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;input type="multiselect" token="categories" searchWhenChanged="false"&amp;gt;
    &amp;lt;label&amp;gt;Select Categories&amp;lt;/label&amp;gt;
    &amp;lt;fieldForLabel&amp;gt;category&amp;lt;/fieldForLabel&amp;gt;
    &amp;lt;fieldForValue&amp;gt;category&amp;lt;/fieldForValue&amp;gt;
    &amp;lt;choice value="All"&amp;gt;All&amp;lt;/choice&amp;gt;
    &amp;lt;search&amp;gt;
       &amp;lt;query&amp;gt;index=abc  "allcategories"
    &amp;lt;/search&amp;gt;
    &amp;lt;prefix&amp;gt;index=abc | where (&amp;lt;/prefix&amp;gt;
    &amp;lt;valuePrefix&amp;gt;category="&amp;lt;/valuePrefix&amp;gt;
    &amp;lt;valueSuffix&amp;gt;"&amp;lt;/valueSuffix&amp;gt;
    &amp;lt;delimiter&amp;gt; OR &amp;lt;/delimiter&amp;gt;
    &amp;lt;suffix&amp;gt;)&amp;lt;/suffix&amp;gt;
    &amp;lt;change&amp;gt;
       &amp;lt;eval token="form.categories"&amp;gt;case(mvcount('form.categories')=0,"All",mvcount('form.categories')&amp;amp;gt;1 AND mvfind('form.categories',"All")&amp;amp;gt;0,"All",mvcount('form.categories')&amp;amp;gt;1 AND mvfind('form.categories',"All")=0,mvfilter('form.categories'!="All"),1==1,'form.categories')&amp;lt;/eval&amp;gt;
       &amp;lt;eval token="search_filter1"&amp;gt;if(mvfind('form.categories',"All")=0,"index=abc",$categories$)&amp;lt;/eval&amp;gt;
   &amp;lt;/change&amp;gt;
&amp;lt;/input&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;Things to note: the static choice of All is first - this is required so that the mvfind will return 0 if All has been selected; the case in the first eval does a number of things, it sets the default to "All", it sets the field to just "All" if "All" is selected when there are other choices selected, it removes "All" if other choices are selected after "All"; the second eval sets the search filter based on whether "All" is at the beginning of the selection; rather than using IN, this builds a set of OR'd comparisons, you could modify it to generate an IN clause if you prefer.&lt;/P&gt;</description>
      <pubDate>Wed, 26 May 2021 09:49:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Change-amp-Condition-within-a-multiselect-with-token/m-p/553105#M38353</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-05-26T09:49:25Z</dc:date>
    </item>
  </channel>
</rss>

