Splunk Search

Panel loading without 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

yuanliu
SplunkTrust
SplunkTrust

the problem is the moment i select any of the value from drop down dependent panels load without waiting for Submit button.


This is not accurate.  In fact, the panel appears the moment any value is selected.  This is expected.  But any search that depends on an input requiring submit will not execute until you submit.

You can observe this using the following play dashboard:

 

 

<form version="1.1" theme="light">
  <label>Test searchWhenChanged</label>
  <description>https://community.splunk.com/t5/Splunk-Search/Panel-loading-without-submit-button/m-p/667821#M229124</description>
  <init>
    <set token="loadsummary">go</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>
      <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>
    </input>
  </fieldset>
  <row>
    <panel>
      <title>Show me funcsummary: $funcsummary$</title>
      <table>
        <search>
          <query>| makeresults
| eval funcsummary = "$funcsummary$"
          </query>
          <earliest>-24h@h</earliest>
          <latest>now</latest>
        </search>
        <option name="drilldown">none</option>
      </table>
    </panel>
    <panel>
      <title>Show me funcsummaryMQ: $funcsummaryMQ$</title>
      <table>
        <search>
          <query>| makeresults
| eval funcsummaryMQ = "$funcsummaryMQ$"</query>
          <earliest>-24h@h</earliest>
          <latest>now</latest>
        </search>
        <option name="drilldown">none</option>
        <option name="refresh.display">progressbar</option>
      </table>
    </panel>
    <panel depends="$funcsummaryMQ$">
      <title>ABC</title>
      <table>
        <search>
          <query>index=_internal</query>
          <earliest>$field1.earliest$</earliest>
          <latest>$field1.latest$</latest>
        </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>
</form>

 

 

The above is true unless a search doesn't even use any input that requires submit - as is the case with your sample panel.  Logically submit must not affect any such search.

The attribute searchWhenChanged in an <input/> only controls <search/>, and is only useful when a particular <search/> utilizes that specific <input searchWhenChanged="false"/>.  It has no effect on <row/> and <panel/>'s depends attribute.  

0 Karma

Satyapv
Engager

hello,

In  this case how do i make sure the panels wait for submit button as as now the moment i select any values in drop down panels start loading?

Thanks

0 Karma

yuanliu
SplunkTrust
SplunkTrust
  1. The panel will always show when depends token is set.
  2. If your search does not use any token defined in <input searchWhenChanged="false"/>, the search will always load, whether the panel is hidden or not.

In other words, your requirement cannot be met.

There is a really silly token gymnastic to hide a panel before submission. (I don't recommend this.)  That is to use a derivative token as depends; to set this token, a search that depends on submission must be performed.  For example:

<form version="1.1" theme="light">
  <label>Test searchWhenChanged</label>
  <description>https://community.splunk.com/t5/Splunk-Search/Panel-loading-without-submit-button/m-p/667821#M229124</description>
  <init>
    <set token="loadsummary">go</set>
  </init>
  <search>
    <query>
      | makeresults
      | eval fake = "$funcsummaryMQ$"
    </query>
    <earliest>$field1.earliest$</earliest>
    <latest>$field1.latest$</latest>
    <progress>
      <condition match="'job.resultCount' != 0">
        <set token="show_panel">true</set>
      </condition>
      <condition>
        <unset token="show_panel"></unset>
      </condition>
    </progress>
  </search>
  <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>
      <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>
    </input>
  </fieldset>
  <row>
    <panel>
      <title>Show me funcsummary: $funcsummary$</title>
      <table>
        <search>
          <query>| makeresults
| eval funcsummary = "$funcsummary$"
          </query>
          <earliest>-24h@h</earliest>
          <latest>now</latest>
        </search>
        <option name="drilldown">none</option>
      </table>
    </panel>
    <panel>
      <title>Show me funcsummaryMQ: $funcsummaryMQ$</title>
      <table>
        <search>
          <query>| makeresults
| eval funcsummaryMQ = "$funcsummaryMQ$"</query>
          <earliest>-24h@h</earliest>
          <latest>now</latest>
        </search>
        <option name="drilldown">none</option>
        <option name="refresh.display">progressbar</option>
      </table>
    </panel>
    <panel depends="$show_panel$">
      <title>ABC show_panel = $show_panel$</title>
      <table>
        <search>
          <query>index=_internal</query>
          <earliest>$field1.earliest$</earliest>
          <latest>$field1.latest$</latest>
        </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>
</form>

As I mentioned above, any hidden search that does not depends on token that requires submission will still be executed.  Only the results will not be visible.

0 Karma
Get Updates on the Splunk Community!

Splunk App for Anomaly Detection End of Life Announcement

Q: What is happening to the Splunk App for Anomaly Detection?A: Splunk is officially announcing the ...

Aligning Observability Costs with Business Value: Practical Strategies

 Join us for an engaging Tech Talk on Aligning Observability Costs with Business Value: Practical ...

Mastering Data Pipelines: Unlocking Value with Splunk

 In today's AI-driven world, organizations must balance the challenges of managing the explosion of data with ...