Dashboards & Visualizations
Highlighted

Custom logic for dashboard - checkbox

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
Highlighted

Re: Custom logic for dashboard - checkbox

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