<?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 get conditional display of panels driven by form tokens in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-get-conditional-display-of-panels-driven-by-form-tokens/m-p/200419#M12586</link>
    <description>&lt;P&gt;So I created a simple test RA dashboard with a &lt;CODE&gt;submit&lt;/CODE&gt; button. I don't see the behavior you are seeing. What am I missing?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form&amp;gt;
  &amp;lt;label&amp;gt;test&amp;lt;/label&amp;gt;
  &amp;lt;fieldset submitButton="true"&amp;gt;
    &amp;lt;input type="checkbox" token="tokChk"&amp;gt;
      &amp;lt;label&amp;gt;Check&amp;lt;/label&amp;gt;
      &amp;lt;choice value="checked"&amp;gt;Checked&amp;lt;/choice&amp;gt;
    &amp;lt;/input&amp;gt;
    &amp;lt;input type="text" token="field1"&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;Checked: $tokChk$&amp;lt;/title&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;| makeresults | eval val=if(len("$tokChk$")=0, "unchecked", "checked") | eval val=val." (".len("$tokChk$").")"&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;-15m&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="mapping.type"&amp;gt;marker&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;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 21 Sep 2016 13:56:07 GMT</pubDate>
    <dc:creator>sundareshr</dc:creator>
    <dc:date>2016-09-21T13:56:07Z</dc:date>
    <item>
      <title>How to get conditional display of panels driven by form tokens</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-get-conditional-display-of-panels-driven-by-form-tokens/m-p/200414#M12581</link>
      <description>&lt;P&gt;Variations of this questions have been asked many times but so far none of what I've seen has helped me. That's why I need your wisdom.&lt;/P&gt;

&lt;P&gt;I have a form with 2 text fields and a check box. I want a panel to appear if the check box is ticked and the text fields are both left to their default value '*'. This is because the check box makes the search use a transaction and if none of the text fields are populated, it's going to have to work on possibly a huge amount of data. If that happens, I want a panel to appear to warn the user.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;fieldset submitButton="true" autoRun="false"&amp;gt;
  &amp;lt;input type="text" token="user_token" searchWhenChanged="false"&amp;gt;
    &amp;lt;label&amp;gt;user&amp;lt;/label&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;
  &amp;lt;input type="text" token="host_token" searchWhenChanged="false"&amp;gt;
    &amp;lt;label&amp;gt;host&amp;lt;/label&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;
  &amp;lt;input type="checkbox" token="transaction_token" searchWhenChanged="false"&amp;gt;
    &amp;lt;label&amp;gt;Transaction&amp;lt;/label&amp;gt;
    &amp;lt;choice value="| transaction session_id"&amp;gt;Transaction&amp;lt;/choice&amp;gt;
    &amp;lt;default&amp;gt;&amp;lt;/default&amp;gt;
  &amp;lt;/input&amp;gt;
&amp;lt;/fieldset&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;To start small, I have tried this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;row&amp;gt;
  &amp;lt;panel depends="$transaction_token$"&amp;gt;
    &amp;lt;html&amp;gt;
      &amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt; blah blah blah
    &amp;lt;/html&amp;gt;
  &amp;lt;/panel&amp;gt;
&amp;lt;/row&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But this displays the panel as soon as I press the submit button, whether or not I have ticked the box.&lt;/P&gt;

&lt;P&gt;So then I tried something like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;input type="checkbox" token="transaction_token" searchWhenChanged="false"&amp;gt;
  &amp;lt;label&amp;gt;Transaction&amp;lt;/label&amp;gt;
  &amp;lt;choice value="| transaction session_id"&amp;gt;Transaction&amp;lt;/choice&amp;gt;
  &amp;lt;default&amp;gt;&amp;lt;/default&amp;gt;
  &amp;lt;change&amp;gt;
    &amp;lt;condition match="isnull($transaction_token$) OR $transaction_token$==&amp;amp;quot;&amp;amp;quot;"&amp;gt;
      &amp;lt;set token="using_transactions_token"&amp;gt;NOTRANSACTION&amp;lt;/set&amp;gt;
    &amp;lt;/condition&amp;gt;
    &amp;lt;condition&amp;gt;
      &amp;lt;unset token="using_transactions_token"/&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;And that almost works but it's erratic just like &lt;A href="https://answers.splunk.com/answers/426435/setting-a-new-token-when-an-input-token-changes-we.html"&gt;a previous question I asked a while ago&lt;/A&gt;. So I thought the fix would be similar and I did:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;input type="checkbox" token="transaction_token" searchWhenChanged="false"&amp;gt;
  &amp;lt;label&amp;gt;Transaction&amp;lt;/label&amp;gt;
  &amp;lt;choice value="| transaction session_id"&amp;gt;Transaction&amp;lt;/choice&amp;gt;
  &amp;lt;default&amp;gt;&amp;lt;/default&amp;gt;
  &amp;lt;change&amp;gt;
    &amp;lt;condition match="isnull($value$) OR $value$==&amp;amp;quot;&amp;amp;quot;"&amp;gt;
      &amp;lt;set token="using_transactions_token"&amp;gt;NOTRANSACTION&amp;lt;/set&amp;gt;
    &amp;lt;/condition&amp;gt;
    &amp;lt;condition&amp;gt;
      &amp;lt;unset token="using_transactions_token"/&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;But that does not work. I even tried &lt;CODE&gt;value&lt;/CODE&gt; instead of &lt;CODE&gt;$value$&lt;/CODE&gt; like I've seen in some other answers here, but to no avail. That is my first hurdle. Once I get that working, I'll then need something similar for the text fields (I think that should be easier) and then I need to get something like this to work:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;row&amp;gt;
  &amp;lt;panel depends="$using_transaction_token$ AND $default_user$ AND $default_host$"&amp;gt;
    &amp;lt;html&amp;gt;
      &amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt; blah blah blah
    &amp;lt;/html&amp;gt;
  &amp;lt;/panel&amp;gt;
&amp;lt;/row&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I'm not even sure if ANDing depends is possible and, if it is, how to do it.&lt;/P&gt;

&lt;P&gt;Beyond helping me with that particular problem, I would be grateful if someone could also advise me on where I can get proper information on how these things work. Searching splunk answers yields the occasional gem, but more often than not it goes in many directions that are not my exact problem. I had a look at &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.4.3/Viz/tokens"&gt;the docs&lt;/A&gt; but they barely scratch the surface of what's possible. So any good resource pointer would be great. Give a man a fish versus teach a man to fish, etc...&lt;/P&gt;

&lt;P&gt;If that's relevant: I'm on 6.4.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Sep 2016 10:54:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-get-conditional-display-of-panels-driven-by-form-tokens/m-p/200414#M12581</guid>
      <dc:creator>gabriel_vasseur</dc:creator>
      <dc:date>2016-09-19T10:54:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to get conditional display of panels driven by form tokens</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-get-conditional-display-of-panels-driven-by-form-tokens/m-p/200415#M12582</link>
      <description>&lt;P&gt;The one change would be to flip your logic. So here's how &lt;CODE&gt;depends&lt;/CODE&gt; and/or &lt;CODE&gt;rejects&lt;/CODE&gt; works. If the token is set (irrespective the value in the token), the panel with &lt;CODE&gt;depends&lt;/CODE&gt; will show, and &lt;CODE&gt;reject&lt;/CODE&gt; will hide. For example &lt;CODE&gt;&amp;lt;set token=sometoken&amp;gt;&amp;lt;/set&amp;gt;&lt;/CODE&gt; will also be considered as a valid token. &lt;CODE&gt;unset&lt;/CODE&gt; is the only way to remove the token. In your example, you have &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;if  isnull($value$) then set
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;even though the values is &lt;CODE&gt;NOTTRANSACTION&lt;/CODE&gt;, &lt;CODE&gt;depends&lt;/CODE&gt; sees the token is set, and will show the panel. Instead, change to &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;if  isnull($value$) then unset else set
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You can use multiple tokens in your depends (remember, if you use &lt;CODE&gt;set&lt;/CODE&gt; token gets set, regardless of value). Although, not sure if you need to explicitly state &lt;CODE&gt;AND&lt;/CODE&gt;. I know &lt;CODE&gt;tokOne, tokTwo, tokThree&lt;/CODE&gt; means all three tokens have to be set for the panel to show. &lt;/P&gt;

&lt;P&gt;Now, instead of unset, you could also use &lt;CODE&gt;rejects&lt;/CODE&gt; to hide panels. Just  a thought.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Sep 2016 13:21:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-get-conditional-display-of-panels-driven-by-form-tokens/m-p/200415#M12582</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-09-19T13:21:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to get conditional display of panels driven by form tokens</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-get-conditional-display-of-panels-driven-by-form-tokens/m-p/200416#M12583</link>
      <description>&lt;P&gt;Thanks, that will be useful once I've past the first hurdle, which is to get a token to be set/unset when the check box is ticked. As I said in my question, the following doesn't work (the token is always set to NOTRANSACTION, presumably because &lt;CODE&gt;$value$&lt;/CODE&gt; is not the right thing to be looking at...):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;   &amp;lt;change&amp;gt;
     &amp;lt;condition match="isnull($value$) OR $value$==&amp;amp;quot;&amp;amp;quot;"&amp;gt;
       &amp;lt;set token="using_transactions_token"&amp;gt;NOTRANSACTION&amp;lt;/set&amp;gt;
     &amp;lt;/condition&amp;gt;
     &amp;lt;condition&amp;gt;
       &amp;lt;unset token="using_transactions_token"/&amp;gt;
     &amp;lt;/condition&amp;gt;
   &amp;lt;/change&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Any suggestions about this?&lt;/P&gt;</description>
      <pubDate>Tue, 20 Sep 2016 07:55:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-get-conditional-display-of-panels-driven-by-form-tokens/m-p/200416#M12583</guid>
      <dc:creator>gabriel_vasseur</dc:creator>
      <dc:date>2016-09-20T07:55:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to get conditional display of panels driven by form tokens</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-get-conditional-display-of-panels-driven-by-form-tokens/m-p/200417#M12584</link>
      <description>&lt;P&gt;The token is set when checkbox is checked and unset when unchecked, so do you need the conditional set?&lt;/P&gt;</description>
      <pubDate>Tue, 20 Sep 2016 12:05:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-get-conditional-display-of-panels-driven-by-form-tokens/m-p/200417#M12584</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-09-20T12:05:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to get conditional display of panels driven by form tokens</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-get-conditional-display-of-panels-driven-by-form-tokens/m-p/200418#M12585</link>
      <description>&lt;P&gt;I'm not sure what you mean, but &lt;CODE&gt;$transaction_token$&lt;/CODE&gt;gets set as soon as I hit the submit button, whether or not the checkbox is ticked. Whatever happens, it is never unset after that. That's why I think I need &lt;CODE&gt;$using_transactions_token$&lt;/CODE&gt;, but I just can't get that to work.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Sep 2016 12:59:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-get-conditional-display-of-panels-driven-by-form-tokens/m-p/200418#M12585</guid>
      <dc:creator>gabriel_vasseur</dc:creator>
      <dc:date>2016-09-21T12:59:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to get conditional display of panels driven by form tokens</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-get-conditional-display-of-panels-driven-by-form-tokens/m-p/200419#M12586</link>
      <description>&lt;P&gt;So I created a simple test RA dashboard with a &lt;CODE&gt;submit&lt;/CODE&gt; button. I don't see the behavior you are seeing. What am I missing?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form&amp;gt;
  &amp;lt;label&amp;gt;test&amp;lt;/label&amp;gt;
  &amp;lt;fieldset submitButton="true"&amp;gt;
    &amp;lt;input type="checkbox" token="tokChk"&amp;gt;
      &amp;lt;label&amp;gt;Check&amp;lt;/label&amp;gt;
      &amp;lt;choice value="checked"&amp;gt;Checked&amp;lt;/choice&amp;gt;
    &amp;lt;/input&amp;gt;
    &amp;lt;input type="text" token="field1"&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;Checked: $tokChk$&amp;lt;/title&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;| makeresults | eval val=if(len("$tokChk$")=0, "unchecked", "checked") | eval val=val." (".len("$tokChk$").")"&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;-15m&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="mapping.type"&amp;gt;marker&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;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 21 Sep 2016 13:56:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-get-conditional-display-of-panels-driven-by-form-tokens/m-p/200419#M12586</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-09-21T13:56:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to get conditional display of panels driven by form tokens</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-get-conditional-display-of-panels-driven-by-form-tokens/m-p/200420#M12587</link>
      <description>&lt;P&gt;Thanks Sundaresh, I do appreciate your spending your time on my issue. I have added the following to your example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;row&amp;gt;
  &amp;lt;panel depends="$tokChk$"&amp;gt;
    &amp;lt;html&amp;gt;
      &amp;lt;h1&amp;gt;Hello World!&amp;lt;/h1&amp;gt;
    &amp;lt;/html&amp;gt;
  &amp;lt;/panel&amp;gt;
&amp;lt;/row&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And it worked as intended: the panel is only displayed if the checkbox is ticked. However, one thing doesn't work as needed, and that's if the checkbox is not ticked, the search doesn't run at all. It just says "Search is waiting for input...". The fix for that is to specify either &lt;CODE&gt;&amp;lt;default&amp;gt;&amp;lt;/default&amp;gt;&lt;/CODE&gt; or &lt;CODE&gt;&amp;lt;initialValue&amp;gt;&amp;lt;/initialValue&amp;gt;&lt;/CODE&gt; in the checkbox definition. If I do that, the search works well whether the box is ticked or not, but now the problem is that the panel that depends on &lt;CODE&gt;$tokChk$&lt;/CODE&gt; is now displayed all the time.&lt;/P&gt;

&lt;P&gt;That's why in my original post I was trying to solve that problem by using another token...&lt;/P&gt;</description>
      <pubDate>Thu, 22 Sep 2016 09:51:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-get-conditional-display-of-panels-driven-by-form-tokens/m-p/200420#M12587</guid>
      <dc:creator>gabriel_vasseur</dc:creator>
      <dc:date>2016-09-22T09:51:33Z</dc:date>
    </item>
  </channel>
</rss>

