I have 2 rows in my dashboard. Each row has a dropdown. In each dropdown, there are 3 choices.
In Row#1, when I search for something out of the 3 choices, the query runs and the result is shown in its panel.
When I move on to Row#2 and search for something out of the 3 choices, the query runs in row#2 and the result is shown in the panel. However, the query for row#1 is still running. How can I automatically stop another row query to execute when I move to next row ?
<form>
<fieldset submitButton="false"></fieldset>
<row>
<panel>
<title>First Row</title>
<input type="dropdown" token="tokSearchOption2" searchWhenChanged="false">
<label>Select Search</label>
<choice value="A">Total number of A</choice>
<choice value="B">Total number of B </choice>
<choice value="C">Total number of C</choice>
<change>
<condition value="A">
<set token="tokSearchA">true</set>
<unset token="tokSearchB"></unset>
<unset token="tokSearchC"></unset>
</condition>
<condition value="B">
<unset token="tokSearchA"></unset>
<unset token="tokSearchC"></unset>
<set token="tokSearchB">true</set>
</condition>
<condition value="C">
<unset token="tokSearchA"></unset>
<unset token="tokSearchB"></unset>
<set token="tokSearchC">true</set>
</condition>
</change>
</input>
</panel>
</row>
<row>
<panel depends="$tokSearchA$">
<title>Total numbers</title>
<single>
<search>
<query>
<My query is here>
</query>
</search>
</single>
</panel>
<panel depends="$tokSearchB$">
<title>Total numbers</title>
<single>
<search>
<query>
My query is here
</query>
</search>
</single>
</panel>
<panel depends="$tokSearchC$">
<title>Total numbers</title>
<single>
<search>
<query>
My query is here
</query>
</search>
</single>
</panel>
</row>
<row>
<panel>
<title>Second Row</title>
<input type="dropdown" token="tokSearchOption3" searchWhenChanged="false">
<label>Select Search</label>
<choice value="A">Total number of C</choice>
<choice value="B">Total number of D </choice>
<choice value="C">Total number of E</choice>
<change>
<condition value="C">
<set token="tokSearchC">true</set>
<unset token="tokSearchD"></unset>
<unset token="tokSearchE"></unset>
</condition>
<condition value="D">
<unset token="tokSearchC"></unset>
<unset token="tokSearchE"></unset>
<set token="tokSearchD">true</set>
</condition>
<condition value="E">
<unset token="tokSearchC"></unset>
<unset token="tokSearchD"></unset>
<set token="tokSearchE">true</set>
</condition>
</change>
</input>
</panel>
</row>
<row>
<panel depends="$tokSearchC$">
<title>Total numbers</title>
<single>
<search>
<query>
<My query is here>
</query>
</search>
</single>
</panel>
<panel depends="$tokSearchD$">
<title>Total numbers</title>
<single>
<search>
<query>
<My query is here>
</query>
</search>
</single>
</panel>
<panel depends="$tokSearchE$">
<title>Total numbers</title>
<single>
<search>
<query>
<My query is here>
</query>
</search>
</single>
</panel>
</row>
</form>
@balash1979 , while you are using the depends
token to show only one panel at a time however, all the remaining query still run in backend. Ideally you should add dummy dependency to each search query with the corresponding depends token in the panel, so that only one query runs at a time. Also while unsetting the tokens through each of your dropdown, you should unset the tokens from the other dropdown as well.
For adding a dummy dependency you can use comment macro. Refer to my answer on one of older questions for using comment macro for dummy dependency for a similar use case: https://answers.splunk.com/answers/683826/how-do-you-set-the-order-of-queries-to-be-run-in-a.html
I have used fields - "$<tokenName>$"
in the following example.
<form>
<label>Row 1 and Row 2 Filter dependency</label>
<fieldset submitButton="false"></fieldset>
<row>
<panel>
<title>First Row</title>
<input type="dropdown" token="tokSearchOption2" searchWhenChanged="false">
<label>Select Search</label>
<choice value="A">Total number of A</choice>
<choice value="B">Total number of B </choice>
<choice value="C">Total number of C</choice>
<change>
<condition value="A">
<set token="tokSearchA">true</set>
<unset token="tokSearchB"></unset>
<unset token="tokSearchC"></unset>
<unset token="tokSearchD"></unset>
<unset token="tokSearchE"></unset>
<unset token="tokSearchF"></unset>
</condition>
<condition value="B">
<unset token="tokSearchA"></unset>
<unset token="tokSearchC"></unset>
<set token="tokSearchB">true</set>
<unset token="tokSearchD"></unset>
<unset token="tokSearchE"></unset>
<unset token="tokSearchF"></unset>
</condition>
<condition value="C">
<unset token="tokSearchA"></unset>
<unset token="tokSearchB"></unset>
<set token="tokSearchC">true</set>
<unset token="tokSearchD"></unset>
<unset token="tokSearchE"></unset>
<unset token="tokSearchF"></unset>
</condition>
</change>
</input>
</panel>
</row>
<row>
<panel depends="$tokSearchA$">
<title>Total numbers</title>
<single>
<search>
<query>
| makeresults
| eval data="Query for Panel A"
| fields - "Run this query only when $tokSearchA$ is set"
</query>
</search>
</single>
</panel>
<panel depends="$tokSearchB$">
<title>Total numbers</title>
<single>
<search>
<query>
| makeresults
| eval data="Query for Panel B"
| fields - "Run this query only when $tokSearchB$ is set"
</query>
</search>
</single>
</panel>
<panel depends="$tokSearchC$">
<title>Total numbers</title>
<single>
<search>
<query>
| makeresults
| eval data="Query for Panel C"
| fields - "Run this query only when $tokSearchC$ is set"
</query>
</search>
</single>
</panel>
</row>
<row>
<panel>
<title>Second Row</title>
<input type="dropdown" token="tokSearchOption3" searchWhenChanged="false">
<label>Select Search</label>
<choice value="D">Total number of D</choice>
<choice value="E">Total number of E </choice>
<choice value="F">Total number of F</choice>
<change>
<condition value="D">
<unset token="tokSearchA"></unset>
<unset token="tokSearchB"></unset>
<unset token="tokSearchC"></unset>
<set token="tokSearchD">true</set>
<unset token="tokSearchE"></unset>
<unset token="tokSearchF"></unset>
</condition>
<condition value="E">
<unset token="tokSearchA"></unset>
<unset token="tokSearchB"></unset>
<unset token="tokSearchC"></unset>
<unset token="tokSearchD"></unset>
<unset token="tokSearchE"></unset>
<set token="tokSearchF">true</set>
</condition>
<condition value="F">
<unset token="tokSearchA"></unset>
<unset token="tokSearchB"></unset>
<unset token="tokSearchC"></unset>
<unset token="tokSearchD"></unset>
<unset token="tokSearchE"></unset>
<set token="tokSearchF">true</set>
</condition>
</change>
</input>
</panel>
</row>
<row>
<panel depends="$tokSearchD$">
<title>Total numbers</title>
<single>
<search>
<query>
| makeresults
| eval data="Query for Panel D"
| fields - "Run this query only when $tokSearchD$ is set"
</query>
</search>
</single>
</panel>
<panel depends="$tokSearchE$">
<title>Total numbers</title>
<single>
<search>
<query>
| makeresults
| eval data="Query for Panel E"
| fields - "Run this query only when $tokSearchE$ is set"
</query>
</search>
</single>
</panel>
<panel depends="$tokSearchF$">
<title>Total numbers</title>
<single>
<search>
<query>
| makeresults
| eval data="Query for Panel F"
| fields - "Run this query only when $tokSearchF$ is set"
</query>
</search>
</single>
</panel>
</row>
</form>
@balash1979 , while you are using the depends
token to show only one panel at a time however, all the remaining query still run in backend. Ideally you should add dummy dependency to each search query with the corresponding depends token in the panel, so that only one query runs at a time. Also while unsetting the tokens through each of your dropdown, you should unset the tokens from the other dropdown as well.
For adding a dummy dependency you can use comment macro. Refer to my answer on one of older questions for using comment macro for dummy dependency for a similar use case: https://answers.splunk.com/answers/683826/how-do-you-set-the-order-of-queries-to-be-run-in-a.html
I have used fields - "$<tokenName>$"
in the following example.
<form>
<label>Row 1 and Row 2 Filter dependency</label>
<fieldset submitButton="false"></fieldset>
<row>
<panel>
<title>First Row</title>
<input type="dropdown" token="tokSearchOption2" searchWhenChanged="false">
<label>Select Search</label>
<choice value="A">Total number of A</choice>
<choice value="B">Total number of B </choice>
<choice value="C">Total number of C</choice>
<change>
<condition value="A">
<set token="tokSearchA">true</set>
<unset token="tokSearchB"></unset>
<unset token="tokSearchC"></unset>
<unset token="tokSearchD"></unset>
<unset token="tokSearchE"></unset>
<unset token="tokSearchF"></unset>
</condition>
<condition value="B">
<unset token="tokSearchA"></unset>
<unset token="tokSearchC"></unset>
<set token="tokSearchB">true</set>
<unset token="tokSearchD"></unset>
<unset token="tokSearchE"></unset>
<unset token="tokSearchF"></unset>
</condition>
<condition value="C">
<unset token="tokSearchA"></unset>
<unset token="tokSearchB"></unset>
<set token="tokSearchC">true</set>
<unset token="tokSearchD"></unset>
<unset token="tokSearchE"></unset>
<unset token="tokSearchF"></unset>
</condition>
</change>
</input>
</panel>
</row>
<row>
<panel depends="$tokSearchA$">
<title>Total numbers</title>
<single>
<search>
<query>
| makeresults
| eval data="Query for Panel A"
| fields - "Run this query only when $tokSearchA$ is set"
</query>
</search>
</single>
</panel>
<panel depends="$tokSearchB$">
<title>Total numbers</title>
<single>
<search>
<query>
| makeresults
| eval data="Query for Panel B"
| fields - "Run this query only when $tokSearchB$ is set"
</query>
</search>
</single>
</panel>
<panel depends="$tokSearchC$">
<title>Total numbers</title>
<single>
<search>
<query>
| makeresults
| eval data="Query for Panel C"
| fields - "Run this query only when $tokSearchC$ is set"
</query>
</search>
</single>
</panel>
</row>
<row>
<panel>
<title>Second Row</title>
<input type="dropdown" token="tokSearchOption3" searchWhenChanged="false">
<label>Select Search</label>
<choice value="D">Total number of D</choice>
<choice value="E">Total number of E </choice>
<choice value="F">Total number of F</choice>
<change>
<condition value="D">
<unset token="tokSearchA"></unset>
<unset token="tokSearchB"></unset>
<unset token="tokSearchC"></unset>
<set token="tokSearchD">true</set>
<unset token="tokSearchE"></unset>
<unset token="tokSearchF"></unset>
</condition>
<condition value="E">
<unset token="tokSearchA"></unset>
<unset token="tokSearchB"></unset>
<unset token="tokSearchC"></unset>
<unset token="tokSearchD"></unset>
<unset token="tokSearchE"></unset>
<set token="tokSearchF">true</set>
</condition>
<condition value="F">
<unset token="tokSearchA"></unset>
<unset token="tokSearchB"></unset>
<unset token="tokSearchC"></unset>
<unset token="tokSearchD"></unset>
<unset token="tokSearchE"></unset>
<set token="tokSearchF">true</set>
</condition>
</change>
</input>
</panel>
</row>
<row>
<panel depends="$tokSearchD$">
<title>Total numbers</title>
<single>
<search>
<query>
| makeresults
| eval data="Query for Panel D"
| fields - "Run this query only when $tokSearchD$ is set"
</query>
</search>
</single>
</panel>
<panel depends="$tokSearchE$">
<title>Total numbers</title>
<single>
<search>
<query>
| makeresults
| eval data="Query for Panel E"
| fields - "Run this query only when $tokSearchE$ is set"
</query>
</search>
</single>
</panel>
<panel depends="$tokSearchF$">
<title>Total numbers</title>
<single>
<search>
<query>
| makeresults
| eval data="Query for Panel F"
| fields - "Run this query only when $tokSearchF$ is set"
</query>
</search>
</single>
</panel>
</row>
</form>