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!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

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

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...