Dashboards & Visualizations

Custom logic for dashboard - checkbox

jasontsang
New Member

I followed http://docs.splunk.com/Documentation/Splunk/6.5.0/Viz/tokens and successfully created some custom logic for a dropdown input.

Problem comes when I tried to use a checkbox instead of a dropdown.

I tried to create a custom logic on my dashboard, however, the problem is that $value$ does not return all the values that I checked.

<input type="checkbox" token="field1">
        <label>field1</label>
        <choice value="1">1</choice>
        <choice value="7">7</choice>
        <choice value="30">30</choice>
        <change>
          <condition>
            <set token="query">(days=$value$)</set>
          </condition>
        </change>
        <delimiter> ,</delimiter>
      </input>

The problem is that $value$ does not return something like "1,7,30", instead, I could only get a single value, which is not enough for my further calculation. Any ways that I can get the full list of checked options? Thanks!

0 Karma

gokadroid
Motivator

In this line <set token="query">(days=$value$)</set> try to replace $value$ with $field1$. The checkbox input token is field1 for your code as seen in this line :- <input type="checkbox" token="field1">.

Please see the code below where I was able to extract all the three values in a comma separated text and used it in the title of the panel and also in the text of the text box. Hope it helps.

<form>
  <label>answers</label>
  <fieldset submitButton="false">
    <input type="checkbox" token="field1">
      <choice value="1">aa</choice>
      <choice value="12">bb</choice>
      <choice value="13">cc</choice>
      <change>
        <condition>
          <set token="query">(days=$field1$)</set>
        </condition>
      </change>
      <delimiter>,</delimiter>
    </input>
    <input type="text" token="field2">
      <default>$field1$</default>
    </input>
  </fieldset>
  <row>
    <panel>
      <table>
        <title>Panel title =  $field1$</title>
        <search>
          <query>$field1$</query>
          <earliest>0</earliest>
        </search>
        <option name="wrap">undefined</option>
        <option name="rowNumbers">undefined</option>
        <option name="drilldown">row</option>
        <option name="dataOverlayMode">none</option>
        <option name="count">10</option>
      </table>
    </panel>
  </row>
</form>
0 Karma
Get Updates on the Splunk Community!

Community Content Calendar, November Edition

Welcome to the November edition of our Community Spotlight! Each month, we dive into the Splunk Community to ...

October Community Champions: A Shoutout to Our Contributors!

As October comes to a close, we want to take a moment to celebrate the people who make the Splunk Community ...

Stay Connected: Your Guide to November Tech Talks, Office Hours, and Webinars!

What are Community Office Hours? Community Office Hours is an interactive 60-minute Zoom series where ...