Dashboards & Visualizations

how to give radio button to choose for business hours or 24/24 in my dashboard

surekhasplunk
Communicator

Hi,

I want to give an option to user to choose using radio button the Time Window.

1st option - 24/24
2nd option - 9AM -6PM

Now how to set this token and its values and use it in the dashboard query ?

Tags (3)
0 Karma
1 Solution

vnravikumar
Champion

Hi

Give a try

<form>
   <label>Date</label>
   <fieldset submitButton="false">
     <input type="radio" token="dateTime">
       <label>field1</label>
       <choice value="24/24">24/24</choice>
       <choice value="9AM -6PM">9AM -6PM</choice>
       <change>
         <condition label="24/24">
           <set token="custom_earliest">@d</set>
           <set token="custom_latest">@d+23h+59m</set>
         </condition>
         <condition label="9AM -6PM">
           <set token="custom_earliest">@d+9h</set>
           <set token="custom_latest">@d+18h</set>
         </condition>
       </change>
     </input>
   </fieldset>
   <row>
     <panel>
       <table>
         <search>
           <query>index="_internal"|dedup _time | table _time</query>
           <earliest>$custom_earliest$</earliest>
           <latest>$custom_latest$</latest>
         </search>
         <option name="drilldown">none</option>
       </table>
     </panel>
   </row>
 </form>

View solution in original post

0 Karma

vnravikumar
Champion

Hi

Give a try

<form>
   <label>Date</label>
   <fieldset submitButton="false">
     <input type="radio" token="dateTime">
       <label>field1</label>
       <choice value="24/24">24/24</choice>
       <choice value="9AM -6PM">9AM -6PM</choice>
       <change>
         <condition label="24/24">
           <set token="custom_earliest">@d</set>
           <set token="custom_latest">@d+23h+59m</set>
         </condition>
         <condition label="9AM -6PM">
           <set token="custom_earliest">@d+9h</set>
           <set token="custom_latest">@d+18h</set>
         </condition>
       </change>
     </input>
   </fieldset>
   <row>
     <panel>
       <table>
         <search>
           <query>index="_internal"|dedup _time | table _time</query>
           <earliest>$custom_earliest$</earliest>
           <latest>$custom_latest$</latest>
         </search>
         <option name="drilldown">none</option>
       </table>
     </panel>
   </row>
 </form>
0 Karma
Get Updates on the Splunk Community!

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...

Splunk APM: New Product Features + Community Office Hours Recap!

Howdy Splunk Community! Over the past few months, we’ve had a lot going on in the world of Splunk Application ...

Index This | Forward, I’m heavy; backward, I’m not. What am I?

April 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...