So basically what I'm trying to do it that I want a radio button at the top of the page and depending on one of the four choices of sais radio button, make a whole swath of panels to appear/disappear. I'm having troubles trying to figure out how to use the tokens to achieve this. Thanks in advance for any help! (I should also mention that I'm running 7.2.5)
hi @thisemailwillbeusedfortesting,
Try this:
<form hideSplunkBar="true">
<label>Choose filters</label>
<fieldset submitButton="false">
<input type="radio" token="checkbox">
<label>Checkbox</label>
<choice value="checkbox1">Show Panel 1</choice>
<choice value="checkbox2">Show Panel 2</choice>
<choice value="checkbox3">Show Panel 3</choice>
<choice value="checkbox4">Show Panel 4</choice>
<change>
<condition value="checkbox1">
<set token="flag1">true</set>
<unset token="flag2"></unset>
<unset token="flag3"></unset>
<unset token="flag4"></unset>
</condition>
<condition value="checkbox2">
<set token="flag2">true</set>
<unset token="flag1"></unset>
<unset token="flag3"></unset>
<unset token="flag4"></unset>
</condition>
<condition value="checkbox3">
<set token="flag3">true</set>
<unset token="flag1"></unset>
<unset token="flag2"></unset>
<unset token="flag4"></unset>
</condition>
<condition value="checkbox4">
<set token="flag4">true</set>
<unset token="flag1"></unset>
<unset token="flag2"></unset>
<unset token="flag3"></unset>
</condition>
</change>
</input>
</fieldset>
<row>
<panel depends="$flag1$">
<title>Panel 1</title>
<table>
<title>Count by sourcetype</title>
<search>
<query>index=_internal earliest=-5m | stats count by sourcetype</query>
</search>
<option name="count">10</option>
<option name="drilldown">none</option>
</table>
</panel>
<panel depends="$flag2$">
<title>Panel 2</title>
<table>
<title>Count by source</title>
<search>
<query>index=_internal earliest=-5m | stats count by source</query>
</search>
<option name="count">10</option>
<option name="drilldown">none</option>
</table>
</panel>
<panel depends="$flag3$">
<title>Panel 3</title>
<table>
<title>Count by host</title>
<search>
<query>index=_internal earliest=-5m | stats count by host</query>
</search>
<option name="count">10</option>
<option name="drilldown">none</option>
</table>
</panel>
<panel depends="$flag4$">
<title>Panel 4</title>
<table>
<title>Count by splunk server</title>
<search>
<query>index=_internal earliest=-5m | stats count by splunk_server</query>
</search>
<option name="count">10</option>
<option name="drilldown">none</option>
</table>
</panel>
</row>
</form>
hi @thisemailwillbeusedfortesting,
Try this:
<form hideSplunkBar="true">
<label>Choose filters</label>
<fieldset submitButton="false">
<input type="radio" token="checkbox">
<label>Checkbox</label>
<choice value="checkbox1">Show Panel 1</choice>
<choice value="checkbox2">Show Panel 2</choice>
<choice value="checkbox3">Show Panel 3</choice>
<choice value="checkbox4">Show Panel 4</choice>
<change>
<condition value="checkbox1">
<set token="flag1">true</set>
<unset token="flag2"></unset>
<unset token="flag3"></unset>
<unset token="flag4"></unset>
</condition>
<condition value="checkbox2">
<set token="flag2">true</set>
<unset token="flag1"></unset>
<unset token="flag3"></unset>
<unset token="flag4"></unset>
</condition>
<condition value="checkbox3">
<set token="flag3">true</set>
<unset token="flag1"></unset>
<unset token="flag2"></unset>
<unset token="flag4"></unset>
</condition>
<condition value="checkbox4">
<set token="flag4">true</set>
<unset token="flag1"></unset>
<unset token="flag2"></unset>
<unset token="flag3"></unset>
</condition>
</change>
</input>
</fieldset>
<row>
<panel depends="$flag1$">
<title>Panel 1</title>
<table>
<title>Count by sourcetype</title>
<search>
<query>index=_internal earliest=-5m | stats count by sourcetype</query>
</search>
<option name="count">10</option>
<option name="drilldown">none</option>
</table>
</panel>
<panel depends="$flag2$">
<title>Panel 2</title>
<table>
<title>Count by source</title>
<search>
<query>index=_internal earliest=-5m | stats count by source</query>
</search>
<option name="count">10</option>
<option name="drilldown">none</option>
</table>
</panel>
<panel depends="$flag3$">
<title>Panel 3</title>
<table>
<title>Count by host</title>
<search>
<query>index=_internal earliest=-5m | stats count by host</query>
</search>
<option name="count">10</option>
<option name="drilldown">none</option>
</table>
</panel>
<panel depends="$flag4$">
<title>Panel 4</title>
<table>
<title>Count by splunk server</title>
<search>
<query>index=_internal earliest=-5m | stats count by splunk_server</query>
</search>
<option name="count">10</option>
<option name="drilldown">none</option>
</table>
</panel>
</row>
</form>
Thank you! This is exactly what I needed. Cheers!
You're welcome 🙂