Dashboards & Visualizations

Panels not waiting on Submit button

Satyapv
Engager

Hello,

I have below code for a dropdown menu and the problem is the moment i select any of the value from drop down dependent panels load without waiting for Submit button. How can this be fixed.

Submit Button code:

<fieldset submitButton="true" autoRun="false">
<input token="field1" type="time" searchWhenChanged="false">
<label>Time Picker</label>
<default>
<earliest>-15m</earliest>
<latest>now</latest>
</default>
</input>

Dropdown and Token

<input type="dropdown" token="subsummary" depends="$loadsummary$" searchWhenChanged="false">
<label>Summary Selection</label>
<choice value="FUNC">Function Summary</choice>
<choice value="MQ">MQ Summary</choice>
<change>
<condition value="FUNC">
<set token="funcsummary">true</set>
<unset token="funcsummaryMQ"></unset>
</condition>
<condition value="MQ">
<set token="funcsummaryMQ">true</set>
<unset token="funcsummary"></unset>
</condition>
</change>

 

Sample Panel:

<row depends="$funcsummaryMQ$">
<panel depends="$funcsummaryMQ$">
<title>ABC</title>
<table>
<search >
<query>index="SAMPLE" </query>
</search>
<option name="count">100</option>
<option name="dataOverlayMode">none</option>
<option name="drilldown">none</option>
<option name="percentagesRow">false</option>
<option name="refresh.display">progressbar</option>
<option name="rowNumbers">false</option>
<option name="wrap">true</option>
</table>
</panel>
</row>

0 Karma

bowesmana
SplunkTrust
SplunkTrust

The problem is because you are using a change block which is run always and not on the submit button, so you are setting the token dependencies when you change the dropdown.

You need to do it a bit differently, so that a search is run based when the submit button is clicked and that search has a <done> clause that will set/unset the panel triggers to show/hide the panels. Note that it uses eval statements to cause the tokens to be set/unset.

See this

<form>
  <label>Submit</label>
  <init>
    <set token="loadsummary"></set>
  </init>
  <fieldset submitButton="true" autoRun="false">
    <input token="field1" type="time" searchWhenChanged="false">
      <label>Time Picker</label>
      <default>
        <earliest>-15m</earliest>
        <latest>now</latest>
      </default>
    </input>
    <input type="dropdown" token="subsummary" depends="$loadsummary$" searchWhenChanged="false">
      <label>Summary Selection</label>
      <choice value="FUNC">Function Summary</choice>
      <choice value="MQ">MQ Summary</choice>
    </input>
  </fieldset>
  <row depends="$funcsummaryMQ$">
    <panel depends="$funcsummaryMQ$">
      <title>ABC</title>
      <table>
        <search>
          <query>index="SAMPLE" </query>
        </search>
        <option name="count">100</option>
        <option name="dataOverlayMode">none</option>
        <option name="drilldown">none</option>
        <option name="percentagesRow">false</option>
        <option name="refresh.display">progressbar</option>
        <option name="rowNumbers">false</option>
        <option name="wrap">true</option>
      </table>
    </panel>
  </row>
  <row depends="$hidden$">
    <panel>
      <table>
        <search>
          <query>
            | makeresults
            | eval ss=$subsummary|s$
          </query>
          <done>
            <eval token="funcsummary">if($result.ss$="FUNC","true",null())</eval>
            <eval token="funcsummaryMQ">if($result.ss$="MQ","true",null())</eval>
          </done>
        </search>
      </table>
    </panel>
  </row>
</form>
0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...