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!

Splunk Mobile: Your Brand-New Home Screen

Meet Your New Mobile Hub  Hello Splunk Community!  Staying connected to your data—no matter where you are—is ...

Introducing Value Insights (Beta): Understand the Business Impact your organization ...

Real progress on your strategic priorities starts with knowing the business outcomes your teams are delivering ...

Enterprise Security (ES) Essentials 8.3 is Now GA — Smarter Detections, Faster ...

As of today, Enterprise Security (ES) Essentials 8.3 is now generally available, helping SOC teams simplify ...