Dashboards & Visualizations

How to use multiple tokens/token values in a checkbox form input to display different panels?

szabados
Communicator

I want to put a set of checkboxes on a dashboard, and display panels according to the checked checkboxes.
I have 3 panels, with an attribute.
I want to create one single checkbox input element, with three checkboxes, like:
Display...
[] panel1
[] panel2
[] panel3

And display each panel respectively. My problem is that a checkbox input element can have only 1 token, but I want to have a separate token for every checkbox option.
So basically, I want to set a separate token for every choice element in the checkbox panel.

0 Karma

gyslainlatsa
Motivator

hi szabados,

try this example and let me know

<form>
   <label>ExampleDynamicPanel</label>
   <fieldset submitButton="false">

     <input type="checkbox" token="token1" searchWhenChanged="true">
        <!--<choice value="*">ANY</choice>
        <default></default>
         The final value will be surrounded by prefix and suffix -->
        <prefix>(</prefix>
        <suffix>)</suffix>
        <!-- Each value will be surrounded by the valuePrefix and valueSuffix -->
        <valuePrefix>temp="</valuePrefix>
        <valueSuffix>"</valueSuffix>
        <!-- All the values and their valuePrefix and valueSuffix will be concatenated together with the delimiter between them -->
        <delimiter> OR </delimiter>
     <populatingSearch fieldForLabel="temp" fieldForValue="temp">|gentimes start=-1 | eval temp="Panel1" | table temp</populatingSearch>
    </input>

      <input type="checkbox" token="token2" searchWhenChanged="true">
        <!--<choice value="*">ANY</choice>
        <default></default>
         The final value will be surrounded by prefix and suffix -->
        <prefix>(</prefix>
        <suffix>)</suffix>
        <!-- Each value will be surrounded by the valuePrefix and valueSuffix -->
        <valuePrefix>temp="</valuePrefix>
        <valueSuffix>"</valueSuffix>
        <!-- All the values and their valuePrefix and valueSuffix will be concatenated together with the delimiter between them -->
        <delimiter> OR </delimiter>
     <populatingSearch fieldForLabel="temp" fieldForValue="temp">|gentimes start=-1 | eval temp="Panel2" | table temp</populatingSearch>
     </input>

     <input type="checkbox" token="token3" searchWhenChanged="true">
        <!--<choice value="*">ANY</choice>
        <default></default>
         The final value will be surrounded by prefix and suffix -->
        <prefix>(</prefix>
        <suffix>)</suffix>
        <!-- Each value will be surrounded by the valuePrefix and valueSuffix -->
        <valuePrefix>temp="</valuePrefix>
        <valueSuffix>"</valueSuffix>
        <!-- All the values and their valuePrefix and valueSuffix will be concatenated together with the delimiter between them -->
        <delimiter> OR </delimiter>
     <populatingSearch fieldForLabel="temp" fieldForValue="temp">|gentimes start=-1 | eval temp="Panel3" | table temp</populatingSearch>
     </input>
   </fieldset>

   <row>
     <panel>
       <chart depends="$token1$">
       <title>Details for $submitted:sourcetype|s$</title>
      <searchString>index=_internal | timechart count</searchString>
         <earliestTime>-15m</earliestTime>
         <latestTime>now</latestTime>
         <option name="charting.chart">column</option>
     </chart>
       <chart depends="$token2$">
       <title>Details for $submitted:sourcetype|s$</title>
      <searchString>index=_internal | timechart count</searchString>
         <earliestTime>-15m</earliestTime>
         <latestTime>now</latestTime>
         <option name="charting.chart">line</option>
     </chart>
       <table depends="$token3$">
         <searchString>index=_internal | timechart count</searchString>
         <earliestTime>-15m</earliestTime>
         <latestTime>now</latestTime>
       </table>
     </panel>
   </row>
 </form>

zeinstein
Path Finder

Hi, I'm having the same problem myself (in Splunk 6.5). I just tried this but the result I get is 3 columns of checkboxes, each containing one checkbox, with the labels: token1, token2 and token3.

0 Karma
Get Updates on the Splunk Community!

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...

Let’s Get You Certified – Vegas-Style at .conf24

Are you ready to level up your Splunk game? Then, let’s get you certified live at .conf24 – our annual user ...