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!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...