<?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: Make a SimpleXML multiselect revert to default value upon emptying box in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Make-a-SimpleXML-multiselect-revert-to-default-value-upon/m-p/149632#M9080</link>
    <description>&lt;P&gt;You might be interested in &lt;A href="http://answers.splunk.com/answers/201552/splunk-615-how-to-get-the-default-selection-from-a.html#answer-223628"&gt;this&lt;/A&gt; question/answer as well.&lt;/P&gt;</description>
    <pubDate>Tue, 21 Apr 2015 11:40:21 GMT</pubDate>
    <dc:creator>jeffland</dc:creator>
    <dc:date>2015-04-21T11:40:21Z</dc:date>
    <item>
      <title>Make a SimpleXML multiselect revert to default value upon emptying box</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Make-a-SimpleXML-multiselect-revert-to-default-value-upon/m-p/149628#M9076</link>
      <description>&lt;P&gt;I have a (Splunk 6.x+ SimpleXML) multiselect dropdown populating a token that is used by other charts on a dashboard.&lt;/P&gt;

&lt;P&gt;The &lt;CODE&gt;input&lt;/CODE&gt;  references a static  &lt;CODE&gt;choice&lt;/CODE&gt; to ensure "ANY" (a value of &lt;CODE&gt;fieldname=*&lt;/CODE&gt;) gets passed upon loading the dashboard.&lt;/P&gt;

&lt;P&gt;Users can select one or more other values, remove the default ANY if desired, and it works fine.&lt;/P&gt;

&lt;P&gt;However, when removing the last item in the multiselect box, the charts disappear, as apparently the token is set back to null. How do I ensure that the token is filled (at least on the back end) with &lt;CODE&gt;fieldname=*&lt;/CODE&gt; (or at least &lt;CODE&gt;*&lt;/CODE&gt;) when this happens, to keep the charts visible at all times?&lt;/P&gt;</description>
      <pubDate>Thu, 16 Apr 2015 15:16:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Make-a-SimpleXML-multiselect-revert-to-default-value-upon/m-p/149628#M9076</guid>
      <dc:creator>Jason</dc:creator>
      <dc:date>2015-04-16T15:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Make a SimpleXML multiselect revert to default value upon emptying box</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Make-a-SimpleXML-multiselect-revert-to-default-value-upon/m-p/149629#M9077</link>
      <description>&lt;P&gt;In your search, add an eval=if(isnull(myfield),"*",myfield)&lt;/P&gt;

&lt;P&gt;So your search might look like sourcetype=xyz $MYFIELDTOKEN$ | eval=if(isnull(myfield),"*",myfield) | blah blah blah....&lt;/P&gt;

&lt;P&gt;Let me know if that works.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Apr 2015 15:36:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Make-a-SimpleXML-multiselect-revert-to-default-value-upon/m-p/149629#M9077</guid>
      <dc:creator>dmaislin_splunk</dc:creator>
      <dc:date>2015-04-16T15:36:27Z</dc:date>
    </item>
    <item>
      <title>Re: Make a SimpleXML multiselect revert to default value upon emptying box</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Make-a-SimpleXML-multiselect-revert-to-default-value-upon/m-p/149630#M9078</link>
      <description>&lt;P&gt;The problem is that if the search (in my case a postprocess, but I think it would work on normal searches like yours as well) calls a token, and that token is now nonexistent (due to the multiselect box being emptied out) the search will not run, and will show "waiting for data". I need to force the first option so the chart never goes blank.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Apr 2015 10:15:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Make-a-SimpleXML-multiselect-revert-to-default-value-upon/m-p/149630#M9078</guid>
      <dc:creator>Jason</dc:creator>
      <dc:date>2015-04-21T10:15:36Z</dc:date>
    </item>
    <item>
      <title>Re: Make a SimpleXML multiselect revert to default value upon emptying box</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Make-a-SimpleXML-multiselect-revert-to-default-value-upon/m-p/149631#M9079</link>
      <description>&lt;P&gt;Thanks to one of my colleagues in Professional Services, this javascript will ensure that if a multiselect box is emptied out, the first &lt;CODE&gt;choice&lt;/CODE&gt; gets added in again.&lt;/P&gt;

&lt;P&gt;&lt;A href="https://gist.github.com/hobbes3/7c52b67c1de5ba4d9dfe"&gt;https://gist.github.com/hobbes3/7c52b67c1de5ba4d9dfe&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Copy this file into your app, restart Splunk, and add &lt;CODE&gt;script="multiselect_force_default.js"&lt;/CODE&gt; to your opening &lt;CODE&gt;dashboard&lt;/CODE&gt; or &lt;CODE&gt;form&lt;/CODE&gt; tag.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Apr 2015 10:17:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Make-a-SimpleXML-multiselect-revert-to-default-value-upon/m-p/149631#M9079</guid>
      <dc:creator>Jason</dc:creator>
      <dc:date>2015-04-21T10:17:38Z</dc:date>
    </item>
    <item>
      <title>Re: Make a SimpleXML multiselect revert to default value upon emptying box</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Make-a-SimpleXML-multiselect-revert-to-default-value-upon/m-p/149632#M9080</link>
      <description>&lt;P&gt;You might be interested in &lt;A href="http://answers.splunk.com/answers/201552/splunk-615-how-to-get-the-default-selection-from-a.html#answer-223628"&gt;this&lt;/A&gt; question/answer as well.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Apr 2015 11:40:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Make-a-SimpleXML-multiselect-revert-to-default-value-upon/m-p/149632#M9080</guid>
      <dc:creator>jeffland</dc:creator>
      <dc:date>2015-04-21T11:40:21Z</dc:date>
    </item>
    <item>
      <title>Re: Make a SimpleXML multiselect revert to default value upon emptying box</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Make-a-SimpleXML-multiselect-revert-to-default-value-upon/m-p/149633#M9081</link>
      <description>&lt;P&gt;Interesting. That seems to solve an issue my customer hadn't asked about, which is ALL remaining in the box upon selecting of something additional. This answer solves the removal of all selected items "breaking" the chart due to no input to the token. I'll have to take a look at your answer when I return to that client.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Apr 2015 11:55:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Make-a-SimpleXML-multiselect-revert-to-default-value-upon/m-p/149633#M9081</guid>
      <dc:creator>Jason</dc:creator>
      <dc:date>2015-04-21T11:55:50Z</dc:date>
    </item>
    <item>
      <title>Re: Make a SimpleXML multiselect revert to default value upon emptying box</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Make-a-SimpleXML-multiselect-revert-to-default-value-upon/m-p/149634#M9082</link>
      <description>&lt;P&gt;Great one &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Feb 2016 09:09:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Make-a-SimpleXML-multiselect-revert-to-default-value-upon/m-p/149634#M9082</guid>
      <dc:creator>support0</dc:creator>
      <dc:date>2016-02-26T09:09:58Z</dc:date>
    </item>
    <item>
      <title>Re: Make a SimpleXML multiselect revert to default value upon emptying box</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Make-a-SimpleXML-multiselect-revert-to-default-value-upon/m-p/149635#M9083</link>
      <description>&lt;P&gt;Just thought I'd post an alternative way of doing this. I'm not a big fan of adding javascript to my dashboards, so I've found a way to do this by adjusting the token for the input using the change &amp;amp; eval attributes. See the example below from one of our dashboards:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    &amp;lt;input type="multiselect" token="host" searchWhenChanged="true"&amp;gt;
      &amp;lt;label&amp;gt;Hosts&amp;lt;/label&amp;gt;
      &amp;lt;search base="lookup"&amp;gt;
        &amp;lt;query&amp;gt;search $env$ | dedup host&amp;lt;/query&amp;gt;
      &amp;lt;/search&amp;gt;
      &amp;lt;valuePrefix&amp;gt;host=&amp;lt;/valuePrefix&amp;gt;
      &amp;lt;delimiter&amp;gt; OR &amp;lt;/delimiter&amp;gt;
      &amp;lt;default&amp;gt;*&amp;lt;/default&amp;gt;
      &amp;lt;choice value="*"&amp;gt;All&amp;lt;/choice&amp;gt;
      &amp;lt;fieldForLabel&amp;gt;host&amp;lt;/fieldForLabel&amp;gt;
      &amp;lt;fieldForValue&amp;gt;host&amp;lt;/fieldForValue&amp;gt;
      &amp;lt;change&amp;gt;
        &amp;lt;eval token="form.host"&amp;gt;if(mvcount('form.host')=0,"*",if(mvcount('form.host')!=1,mvfilter('form.host'!="*"),'form.host'))&amp;lt;/eval&amp;gt;
      &amp;lt;/change&amp;gt;
    &amp;lt;/input&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This will reset the token to 'All' if no options are selected, and will remove the 'All' option if more than 1 are selected.&lt;/P&gt;</description>
      <pubDate>Sat, 17 Feb 2018 04:12:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Make-a-SimpleXML-multiselect-revert-to-default-value-upon/m-p/149635#M9083</guid>
      <dc:creator>ashleyherbert</dc:creator>
      <dc:date>2018-02-17T04:12:37Z</dc:date>
    </item>
    <item>
      <title>Re: Make a SimpleXML multiselect revert to default value upon emptying box</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Make-a-SimpleXML-multiselect-revert-to-default-value-upon/m-p/149636#M9084</link>
      <description>&lt;P&gt;There's no need to use this Javascript on 7.x. If you set a default value for the multi-select you can't de-select it such that it causes the viz to disappear. The default can't be removed from the multi-select.&lt;/P&gt;</description>
      <pubDate>Wed, 08 May 2019 20:18:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Make-a-SimpleXML-multiselect-revert-to-default-value-upon/m-p/149636#M9084</guid>
      <dc:creator>shaskell_splunk</dc:creator>
      <dc:date>2019-05-08T20:18:48Z</dc:date>
    </item>
  </channel>
</rss>

