Dashboards & Visualizations

Disable Code From Running

Motivator

Hi,

I wonder whether someone could help me please:

I'm using the following XML dashboard script with dynamic panels dependent on user selection of a drop down menu:

<?xml version="1.0" encoding="UTF-8"?>
<form>
   <search>
      <query>| makeresults</query>
      <earliest>$time.earliest$</earliest>
      <latest>$time.latest$</latest>
      <progress>
         <eval token="toEarliest">strptime($job.earliestTime$,"%Y-%m-%dT%H:%M:%S..%3N%z")</eval>
         <eval token="toLatest">strptime($job.latestTime$,"%Y-%m-%dT%H:%M:%S..%3N%z")</eval>
         <set token="jobEarliest">$job.earliestTime$</set>
         <set token="jobLatest">$job.latestTime$</set>
      </progress>
   </search>
   <label>CoDE Company Car Data V2</label>
   <fieldset submitButton="false">
      <input type="dropdown" token="selectdata">
         <label>Select the Data Range</label>
         <choice value="pre2019">Pre 2019</choice>
         <choice value="2019Onwards">2019 - Current</choice>
        <change>
         <condition value="pre2019">
           <set token="show_pre2019">true</set>
           <unset token="show_2019Onwards"></unset>
         </condition>
         <condition value="2019Onwards">
           <set token="show_2019Onwards">true</set>
           <unset token="show_pre2019"></unset>
         </condition>
         <condition>
           <unset token="show_2019Onwards"></unset>
           <unset token="show_pre2019"></unset>
         </condition>
       </change>
      </input>
      <input type="time" token="time">
         <label>Please select the time range</label>
         <default>
            <earliest>-24h@h</earliest>
            <latest>now</latest>
         </default>
      </input>
   </fieldset>
   <row>
       <panel depends="$show_pre2019$" rejects="$show_2019Onwards$">
         <title>Pre 2019</title>
         <table>
            <search>
               <query> index=summary_dg_code report=Login2018codedata 
| stats sum(eval(if(signout="1", "1", ""))) as signout sum(eval(if(PA="1", "1", ""))) as PA sum(eval(if(PA_PF="1", "1", ""))) as PTA_PREF sum(eval(if(PA_AD="1", "1", ""))) as PA_AD sum(eval(if(PA_AD_D="1", "1", ""))) as PTA_AD_D sum(eval(if(PA_I="1", "1", ""))) as PA_I sum(eval(if(PA_I_Letter="1", "1", ""))) as PA_I_Letter sum(eval(if(PA_S="1", "1", ""))) as PA_A sum(eval(if(income="1", "1", ""))) as income sum(eval(if(income_ben="1", "1", ""))) as income_ben sum(eval(if(income_update="1", "1", ""))) as income_update sum(eval(if(income_print="1", "1", ""))) as income_print sum(eval(if(car="1", "1", ""))) as car sum(eval(if(car_sub="1", "1", ""))) as car_sub sum(eval(if(ben="1", "1", ""))) as ben sum(eval(if(ben_submit="1", "1", ""))) as ben_sub sum(eval(if(NP="1", "1", ""))) as NP sum(eval(if(calc="1", "1", ""))) as calc sum(eval(if(ts="1", "1", ""))) as ts sum(eval(if(ts_CoC="1", "1", ""))) as ts_C sum(eval(if(ts_C_sub="1", "1", ""))) as ts_C_sub sum(eval(if(s_schedule="1", "1", ""))) as s_schedule sum(eval(if(t="1", "1", ""))) as t sum(eval(if(t_sub="1", "1", ""))) as t_sub sum(eval(if(forms="1", "1", ""))) as forms sum(eval(if(payments="1", "1", ""))) as payments sum(eval(if(rep="1", "1", ""))) as rep sum(eval(if(rep_sub="1", "1", ""))) as rep_sub sum(eval(if(forms_ChB="1", "1", ""))) as forms_CB sum(eval(if(forms_C="1", "1", ""))) as forms_C sum(eval(if(forms_P="1", "1", ""))) as forms_P sum(eval(if(forms_S="1", "1", ""))) as forms_S sum(eval(if(forms_sub="1", "1", ""))) as forms_submit by "X-sessionId" time endtime nino login EEpoch LEpoch
| eval earliest = $toEarliest$ | eval latest = if($toLatest$ &lt; 0,now(),$toLatest$)
|  where EEpoch >=earliest AND LEpoch <=latest
| fields - EEpoch LEpoch earliest latest </query>
            </search>
            <option name="drilldown">none</option>
         </table>
      </panel>
   </row>
   <row>
      <panel depends="$show_2019Onwards$" rejects="$show_pre2019$">
         <title>2019 - Current</title>
         <table>
            <search>
               <query>index=summary_dg_code report=Login2019codedata
| stats sum(eval(if(signout="1", "1", ""))) as signout sum(eval(if(PA="1", "1", ""))) as PA sum(eval(if(PA_PF="1", "1", ""))) as PTA_PREF sum(eval(if(PA_AD="1", "1", ""))) as PA_AD sum(eval(if(PA_AD_D="1", "1", ""))) as PTA_AD_D sum(eval(if(PA_I="1", "1", ""))) as PA_I sum(eval(if(PA_I_Letter="1", "1", ""))) as PA_I_Letter sum(eval(if(PA_S="1", "1", ""))) as PA_A sum(eval(if(income="1", "1", ""))) as income sum(eval(if(income_ben="1", "1", ""))) as income_ben sum(eval(if(income_update="1", "1", ""))) as income_update sum(eval(if(income_print="1", "1", ""))) as income_print sum(eval(if(car="1", "1", ""))) as car sum(eval(if(car_sub="1", "1", ""))) as car_sub sum(eval(if(ben="1", "1", ""))) as ben sum(eval(if(ben_submit="1", "1", ""))) as ben_sub sum(eval(if(NP="1", "1", ""))) as NP sum(eval(if(calc="1", "1", ""))) as calc sum(eval(if(ts="1", "1", ""))) as ts sum(eval(if(ts_CoC="1", "1", ""))) as ts_C sum(eval(if(ts_C_sub="1", "1", ""))) as ts_C_sub sum(eval(if(s_schedule="1", "1", ""))) as s_schedule sum(eval(if(t="1", "1", ""))) as t sum(eval(if(t_sub="1", "1", ""))) as t_sub sum(eval(if(forms="1", "1", ""))) as forms sum(eval(if(payments="1", "1", ""))) as payments sum(eval(if(rep="1", "1", ""))) as rep sum(eval(if(rep_sub="1", "1", ""))) as rep_sub sum(eval(if(forms_ChB="1", "1", ""))) as forms_CB sum(eval(if(forms_C="1", "1", ""))) as forms_C sum(eval(if(forms_P="1", "1", ""))) as forms_P sum(eval(if(forms_S="1", "1", ""))) as forms_S sum(eval(if(forms_sub="1", "1", ""))) as forms_submit by "X-sessionId" time endtime nino login EEpoch LEpoch
| eval earliest = $toEarliest$ | eval latest = if($toLatest$ &lt; 0,now(),$toLatest$)
|  where EEpoch >=earliest AND LEpoch <=latest
| fields - EEpoch LEpoch earliest latest</query>
            </search>
            <option name="drilldown">none</option>
         </table>
      </panel>
   </row>
</form>

The problem I have is that when the user selects the second panel, the first correctly is hidden, but it takes an inordinate amount of time to extract the data and I suspect that it's because the first query is still running.

Could someone tell me please is there a way in which I can stop the first query running?

Many thanks and kind regards

Chris

0 Karma

Motivator

Hi @vnravikumar.

Thank you for this.

Unfortunately this doesn't seem to have made any difference to the load time.

Many thanks and kind regards

Chris

0 Karma

Path Finder

I have been struggling with the same issue... cannot seem to get another panel search to be disabled and stop running. Even when all of the "searchWhenChanged" fields are set to false. https://answers.splunk.com/answers/231685/how-to-disable-a-search-for-a-dashboard-panel.html

0 Karma

Champion

Hi

Give a try, I had dummy eval at the end of the query.

<form>
    <search>
       <query>| makeresults</query>
       <earliest>$time.earliest$</earliest>
       <latest>$time.latest$</latest>
       <progress>
          <eval token="toEarliest">strptime($job.earliestTime$,"%Y-%m-%dT%H:%M:%S..%3N%z")</eval>
          <eval token="toLatest">strptime($job.latestTime$,"%Y-%m-%dT%H:%M:%S..%3N%z")</eval>
          <set token="jobEarliest">$job.earliestTime$</set>
          <set token="jobLatest">$job.latestTime$</set>
       </progress>
    </search>
    <label>CoDE Company Car Data V2</label>
    <fieldset submitButton="false">
       <input type="dropdown" token="selectdata">
          <label>Select the Data Range</label>
          <choice value="pre2019">Pre 2019</choice>
          <choice value="2019Onwards">2019 - Current</choice>
         <change>
          <condition value="pre2019">
            <set token="show_pre2019">true</set>
            <unset token="show_2019Onwards"></unset>
          </condition>
          <condition value="2019Onwards">
            <set token="show_2019Onwards">true</set>
            <unset token="show_pre2019"></unset>
          </condition>
          <condition>
            <unset token="show_2019Onwards"></unset>
            <unset token="show_pre2019"></unset>
          </condition>
        </change>
       </input>
       <input type="time" token="time">
          <label>Please select the time range</label>
          <default>
             <earliest>-24h@h</earliest>
             <latest>now</latest>
          </default>
       </input>
    </fieldset>
    <row>
        <panel depends="$show_pre2019$" rejects="$show_2019Onwards$">
          <title>Pre 2019</title>
          <table>
             <search>
                <query> index=summary_dg_code report=Login2018codedata 
 | stats sum(eval(if(signout="1", "1", ""))) as signout sum(eval(if(PA="1", "1", ""))) as PA sum(eval(if(PA_PF="1", "1", ""))) as PTA_PREF sum(eval(if(PA_AD="1", "1", ""))) as PA_AD sum(eval(if(PA_AD_D="1", "1", ""))) as PTA_AD_D sum(eval(if(PA_I="1", "1", ""))) as PA_I sum(eval(if(PA_I_Letter="1", "1", ""))) as PA_I_Letter sum(eval(if(PA_S="1", "1", ""))) as PA_A sum(eval(if(income="1", "1", ""))) as income sum(eval(if(income_ben="1", "1", ""))) as income_ben sum(eval(if(income_update="1", "1", ""))) as income_update sum(eval(if(income_print="1", "1", ""))) as income_print sum(eval(if(car="1", "1", ""))) as car sum(eval(if(car_sub="1", "1", ""))) as car_sub sum(eval(if(ben="1", "1", ""))) as ben sum(eval(if(ben_submit="1", "1", ""))) as ben_sub sum(eval(if(NP="1", "1", ""))) as NP sum(eval(if(calc="1", "1", ""))) as calc sum(eval(if(ts="1", "1", ""))) as ts sum(eval(if(ts_CoC="1", "1", ""))) as ts_C sum(eval(if(ts_C_sub="1", "1", ""))) as ts_C_sub sum(eval(if(s_schedule="1", "1", ""))) as s_schedule sum(eval(if(t="1", "1", ""))) as t sum(eval(if(t_sub="1", "1", ""))) as t_sub sum(eval(if(forms="1", "1", ""))) as forms sum(eval(if(payments="1", "1", ""))) as payments sum(eval(if(rep="1", "1", ""))) as rep sum(eval(if(rep_sub="1", "1", ""))) as rep_sub sum(eval(if(forms_ChB="1", "1", ""))) as forms_CB sum(eval(if(forms_C="1", "1", ""))) as forms_C sum(eval(if(forms_P="1", "1", ""))) as forms_P sum(eval(if(forms_S="1", "1", ""))) as forms_S sum(eval(if(forms_sub="1", "1", ""))) as forms_submit by "X-sessionId" time endtime nino login EEpoch LEpoch
 | eval earliest = $toEarliest$ | eval latest = if($toLatest$ < 0,now(),$toLatest$)
 |  where EEpoch >=earliest AND LEpoch <=latest
 | fields - EEpoch LEpoch earliest latest |eval temp=$show_pre2019$ </query>
             </search>
             <option name="drilldown">none</option>
          </table>
       </panel>
    </row>
    <row>
       <panel depends="$show_2019Onwards$" rejects="$show_pre2019$">
          <title>2019 - Current</title>
          <table>
             <search>
                <query>index=summary_dg_code report=Login2019codedata
 | stats sum(eval(if(signout="1", "1", ""))) as signout sum(eval(if(PA="1", "1", ""))) as PA sum(eval(if(PA_PF="1", "1", ""))) as PTA_PREF sum(eval(if(PA_AD="1", "1", ""))) as PA_AD sum(eval(if(PA_AD_D="1", "1", ""))) as PTA_AD_D sum(eval(if(PA_I="1", "1", ""))) as PA_I sum(eval(if(PA_I_Letter="1", "1", ""))) as PA_I_Letter sum(eval(if(PA_S="1", "1", ""))) as PA_A sum(eval(if(income="1", "1", ""))) as income sum(eval(if(income_ben="1", "1", ""))) as income_ben sum(eval(if(income_update="1", "1", ""))) as income_update sum(eval(if(income_print="1", "1", ""))) as income_print sum(eval(if(car="1", "1", ""))) as car sum(eval(if(car_sub="1", "1", ""))) as car_sub sum(eval(if(ben="1", "1", ""))) as ben sum(eval(if(ben_submit="1", "1", ""))) as ben_sub sum(eval(if(NP="1", "1", ""))) as NP sum(eval(if(calc="1", "1", ""))) as calc sum(eval(if(ts="1", "1", ""))) as ts sum(eval(if(ts_CoC="1", "1", ""))) as ts_C sum(eval(if(ts_C_sub="1", "1", ""))) as ts_C_sub sum(eval(if(s_schedule="1", "1", ""))) as s_schedule sum(eval(if(t="1", "1", ""))) as t sum(eval(if(t_sub="1", "1", ""))) as t_sub sum(eval(if(forms="1", "1", ""))) as forms sum(eval(if(payments="1", "1", ""))) as payments sum(eval(if(rep="1", "1", ""))) as rep sum(eval(if(rep_sub="1", "1", ""))) as rep_sub sum(eval(if(forms_ChB="1", "1", ""))) as forms_CB sum(eval(if(forms_C="1", "1", ""))) as forms_C sum(eval(if(forms_P="1", "1", ""))) as forms_P sum(eval(if(forms_S="1", "1", ""))) as forms_S sum(eval(if(forms_sub="1", "1", ""))) as forms_submit by "X-sessionId" time endtime nino login EEpoch LEpoch
 | eval earliest = $toEarliest$ | eval latest = if($toLatest$ < 0,now(),$toLatest$)
 |  where EEpoch >=earliest AND LEpoch <=latest
 | fields - EEpoch LEpoch earliest latest |eval temp=$show_2019Onwards$</query>
             </search>
             <option name="drilldown">none</option>
          </table>
       </panel>
    </row>
 </form>
0 Karma