<?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: How to use a condition-set token from one drop-down as a default value for another drop-down in Simple XML? in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-use-a-condition-set-token-from-one-drop-down-as-a-default/m-p/262526#M16553</link>
    <description>&lt;P&gt;would you mind sharing the code for the whole dashboard? I can't seem to make this work. thanks&lt;/P&gt;</description>
    <pubDate>Fri, 22 Jan 2016 12:27:04 GMT</pubDate>
    <dc:creator>asimagu</dc:creator>
    <dc:date>2016-01-22T12:27:04Z</dc:date>
    <item>
      <title>How to use a condition-set token from one drop-down as a default value for another drop-down in Simple XML?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-use-a-condition-set-token-from-one-drop-down-as-a-default/m-p/262521#M16548</link>
      <description>&lt;P&gt;I'm trying to use a condition-set token from one drop-down as a default value for another drop-down.&lt;BR /&gt;
In the code below, &lt;CODE&gt;$DefaultId$&lt;/CODE&gt; is set conditionally by "Source" and used as default by "Target".&lt;/P&gt;

&lt;P&gt;However, the token &lt;CODE&gt;$DefaultId$&lt;/CODE&gt; doesn't turn to its value and remains as literal string &lt;CODE&gt;"$DefaultId$"&lt;/CODE&gt; (not AAA or BBB).&lt;BR /&gt;
The drop-down displays an error since it cannot populate the default.&lt;/P&gt;

&lt;P&gt;In the mean time, if I insert an HTML block between drop-downs to debug and refer &lt;CODE&gt;$DefaultId$&lt;/CODE&gt; there, it works.&lt;BR /&gt;
It also works in search query texts.&lt;/P&gt;

&lt;P&gt;Is it possible to use the token value in "default" tags or input labels without custom js code?&lt;/P&gt;

&lt;P&gt;--&lt;/P&gt;

&lt;P&gt;Source drop-down:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; &amp;lt;input type="dropdown" token="Source" searchWhenChanged="true"&amp;gt;
     &amp;lt;label&amp;gt;Server:&amp;lt;/label&amp;gt;
     &amp;lt;choice value="s1.com"&amp;gt;S1&amp;lt;/choice&amp;gt;
     &amp;lt;choice value="s2.com"&amp;gt;S2&amp;lt;/choice&amp;gt;
     &amp;lt;choice value="*"&amp;gt;(All)&amp;lt;/choice&amp;gt;
     &amp;lt;default&amp;gt;s1.com&amp;lt;/default&amp;gt;
     &amp;lt;change&amp;gt;
          &amp;lt;condition label="S1"&amp;gt;
            &amp;lt;set token="DefaultId"&amp;gt;AAA&amp;lt;/set&amp;gt;
          &amp;lt;/condition&amp;gt;
          &amp;lt;condition label="S2"&amp;gt;
            &amp;lt;set token="DefaultId"&amp;gt;BBB&amp;lt;/set&amp;gt;
          &amp;lt;/condition&amp;gt;
    &amp;lt;/change&amp;gt;
 &amp;lt;/input&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Target drop-down:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;input type="dropdown" token="Target" searchWhenChanged="true"&amp;gt;
  &amp;lt;label&amp;gt;ID:&amp;lt;/label&amp;gt;
  &amp;lt;search&amp;gt;
    &amp;lt;query&amp;gt;...some query...&amp;lt;/query&amp;gt;
  &amp;lt;/search&amp;gt;
  &amp;lt;fieldForLabel&amp;gt;Name&amp;lt;/fieldForLabel&amp;gt;
  &amp;lt;fieldForValue&amp;gt;Id&amp;lt;/fieldForValue&amp;gt;
  &amp;lt;default&amp;gt;$DefaultId$&amp;lt;/default&amp;gt;
&amp;lt;/input&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 04 Dec 2015 12:31:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-use-a-condition-set-token-from-one-drop-down-as-a-default/m-p/262521#M16548</guid>
      <dc:creator>greg</dc:creator>
      <dc:date>2015-12-04T12:31:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to use a condition-set token from one drop-down as a default value for another drop-down in Simple XML?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-use-a-condition-set-token-from-one-drop-down-as-a-default/m-p/262522#M16549</link>
      <description>&lt;P&gt;Hello Greg,&lt;/P&gt;

&lt;P&gt;Below code worked for me . Just noticed that, if you have selected any other value from the Target drop down where the value is not set by the &lt;STRONG&gt;condition&lt;/STRONG&gt;,then you will have to clear the target dropdown by clicking on the 'x' button to restore the default values.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  &amp;lt;fieldset submitButton="false"&amp;gt;
    &amp;lt;input type="dropdown" token="Source" searchWhenChanged="true"&amp;gt;
      &amp;lt;label&amp;gt;Server:&amp;lt;/label&amp;gt;
      &amp;lt;choice value="s1.com"&amp;gt;S1&amp;lt;/choice&amp;gt;
      &amp;lt;choice value="s2.com"&amp;gt;S2&amp;lt;/choice&amp;gt;
      &amp;lt;choice value="*"&amp;gt;(All)&amp;lt;/choice&amp;gt;
      &amp;lt;default&amp;gt;S1&amp;lt;/default&amp;gt;
      &amp;lt;change&amp;gt;
        &amp;lt;condition label="S1"&amp;gt;
          &amp;lt;set token="DefaultId"&amp;gt;AAA&amp;lt;/set&amp;gt;
        &amp;lt;/condition&amp;gt;
        &amp;lt;condition label="S2"&amp;gt;
          &amp;lt;set token="DefaultId"&amp;gt;BBB&amp;lt;/set&amp;gt;
        &amp;lt;/condition&amp;gt;
      &amp;lt;/change&amp;gt;
    &amp;lt;/input&amp;gt;
    &amp;lt;input type="dropdown" token="Target" searchWhenChanged="true"&amp;gt;
      &amp;lt;label&amp;gt;ID&amp;lt;/label&amp;gt;
      &amp;lt;choice value="$DefaultId$"&amp;gt;DefaultId&amp;lt;/choice&amp;gt;
      &amp;lt;default&amp;gt;$DefaultId$&amp;lt;/default&amp;gt;
    &amp;lt;/input&amp;gt;
  &amp;lt;/fieldset&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Attaching a screen shot&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/868iD805CB8355074E76/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;Hope this helps!&lt;/P&gt;</description>
      <pubDate>Mon, 07 Dec 2015 03:44:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-use-a-condition-set-token-from-one-drop-down-as-a-default/m-p/262522#M16549</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2015-12-07T03:44:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to use a condition-set token from one drop-down as a default value for another drop-down in Simple XML?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-use-a-condition-set-token-from-one-drop-down-as-a-default/m-p/262523#M16550</link>
      <description>&lt;P&gt;Thank you for pointing out such workaround, but it didn't work for me.&lt;/P&gt;

&lt;P&gt;I can't understand how you managed this line of code to work:&lt;BR /&gt;
&amp;lt;default&amp;gt;$DefaultId$&amp;lt;/default&amp;gt;&lt;BR /&gt;
Any time I'm trying to insert a $-tokenized value into &amp;lt;default&amp;gt; parameter, dropdown and other downstream modules fail to appear on the form at all. I'm not even talking about correct token substitution.&lt;/P&gt;

&lt;P&gt;It fails if I copy and adapt your sample as well as in my original code.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Dec 2015 11:46:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-use-a-condition-set-token-from-one-drop-down-as-a-default/m-p/262523#M16550</guid>
      <dc:creator>greg</dc:creator>
      <dc:date>2015-12-07T11:46:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to use a condition-set token from one drop-down as a default value for another drop-down in Simple XML?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-use-a-condition-set-token-from-one-drop-down-as-a-default/m-p/262524#M16551</link>
      <description>&lt;P&gt;Try to do it from the input panel editor, not from source code and try. &lt;/P&gt;</description>
      <pubDate>Mon, 07 Dec 2015 13:29:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-use-a-condition-set-token-from-one-drop-down-as-a-default/m-p/262524#M16551</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2015-12-07T13:29:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to use a condition-set token from one drop-down as a default value for another drop-down in Simple XML?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-use-a-condition-set-token-from-one-drop-down-as-a-default/m-p/262525#M16552</link>
      <description>&lt;P&gt;OK, with panel editor it seems to work.&lt;BR /&gt;
But these are very weird limitations - only if specify it in panel editor and only for hardcoded values (S1 -&amp;gt; AAA, S2 -&amp;gt; BBB). Editing the source code or adding dynamic search for the second dropdown still remain non-functional.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Dec 2015 14:46:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-use-a-condition-set-token-from-one-drop-down-as-a-default/m-p/262525#M16552</guid>
      <dc:creator>greg</dc:creator>
      <dc:date>2015-12-07T14:46:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to use a condition-set token from one drop-down as a default value for another drop-down in Simple XML?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-use-a-condition-set-token-from-one-drop-down-as-a-default/m-p/262526#M16553</link>
      <description>&lt;P&gt;would you mind sharing the code for the whole dashboard? I can't seem to make this work. thanks&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jan 2016 12:27:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-use-a-condition-set-token-from-one-drop-down-as-a-default/m-p/262526#M16553</guid>
      <dc:creator>asimagu</dc:creator>
      <dc:date>2016-01-22T12:27:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to use a condition-set token from one drop-down as a default value for another drop-down in Simple XML?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-use-a-condition-set-token-from-one-drop-down-as-a-default/m-p/262527#M16554</link>
      <description>&lt;P&gt;Perfect!!! it helped me a lot and it works, also with unset too!&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;     &amp;lt;condition label="Esercizio"&amp;gt;
       &amp;lt;set token="vistaESE"&amp;gt;Esercizio&amp;lt;/set&amp;gt;
       &amp;lt;unset token="vistaINTR1"&amp;gt;&amp;lt;/unset&amp;gt;
       &amp;lt;unset token="vistaINTR2"&amp;gt;&amp;lt;/unset&amp;gt;
       &amp;lt;unset token="vistaSYSR2"&amp;gt;&amp;lt;/unset&amp;gt;
       &amp;lt;unset token="vistaPREP"&amp;gt;&amp;lt;/unset&amp;gt;
     &amp;lt;/condition&amp;gt;
     &amp;lt;condition label="INTR1"&amp;gt;
        &amp;lt;unset token="vistaESE"&amp;gt;&amp;lt;/unset&amp;gt;
        &amp;lt;set token="vistaINTR1"&amp;gt;INTR1&amp;lt;/set&amp;gt;
        &amp;lt;unset token="vistaINTR2"&amp;gt;&amp;lt;/unset&amp;gt;
        &amp;lt;unset token="vistaSYSR2"&amp;gt;&amp;lt;/unset&amp;gt;
        &amp;lt;unset token="vistaPREP"&amp;gt;&amp;lt;/unset&amp;gt;
     &amp;lt;/condition&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and so on... to drive several hidden panels in my dashboard!&lt;BR /&gt;
Marco&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jul 2018 14:20:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-use-a-condition-set-token-from-one-drop-down-as-a-default/m-p/262527#M16554</guid>
      <dc:creator>marcoscala</dc:creator>
      <dc:date>2018-07-09T14:20:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to use a condition-set token from one drop-down as a default value for another drop-down in Simple XML?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-use-a-condition-set-token-from-one-drop-down-as-a-default/m-p/262528#M16555</link>
      <description>&lt;P&gt;I tried similar solution, which didnt work for me. I just copied and triedrenjith code, that also didnt work.logically it should work though.&lt;BR /&gt;
I am using splunk version Version: 7.1.3 Build:51d9cac7b837&lt;/P&gt;

&lt;P&gt;Can anyone help whats wrong with my code? The problem is, its not executing set that was with in condition. if I remove condition, its able to set.&lt;BR /&gt;
I have all which expands to "*" and remaining fields populated using search.&lt;BR /&gt;
I want to set variable depending on All label.  &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  &amp;lt;label&amp;gt;Name&amp;lt;/label&amp;gt;
  &amp;lt;choice value="*"&amp;gt;All&amp;lt;/choice&amp;gt;
  &amp;lt;change&amp;gt;
     &amp;lt;condition &amp;gt;
       &amp;lt;unset token="show_panel_select"&amp;gt;&amp;lt;/unset&amp;gt;
     &amp;lt;/condition&amp;gt;

     &amp;lt;condition label = "All" &amp;gt;
       &amp;lt;set token="show_panel_select"&amp;gt;true&amp;lt;/set&amp;gt;
     &amp;lt;/condition&amp;gt;

   &amp;lt;/change&amp;gt;
  &amp;lt;search&amp;gt;
                 ...........my search.........
  &amp;lt;/search&amp;gt;
  &amp;lt;default&amp;gt;*&amp;lt;/default&amp;gt;
  &amp;lt;initialValue&amp;gt;*&amp;lt;/initialValue&amp;gt;
&amp;lt;/input&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 29 Nov 2018 09:13:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-use-a-condition-set-token-from-one-drop-down-as-a-default/m-p/262528#M16555</guid>
      <dc:creator>venu_s</dc:creator>
      <dc:date>2018-11-29T09:13:30Z</dc:date>
    </item>
  </channel>
</rss>

