Dashboards & Visualizations

Use Timepicker Token With Field

IRHM73
Motivator

Hi,

I wonder whether someone could help me please.

I'm using a query which interrogates a Summary Index containing two fields called Epoch_STime and Epoch_ETime.

I'm then using the query in a dashboard panel which includes a timepicker called "timerange".

What I'm trying to do is set the earliest time from the timepicker to the Epoch_STime and the latest date of the timepicker to Epoch_ETime.

I've tried earliest=$Epoch_Stime$ and the same for the latest time , but I can't get this to work.

Could someone possibly look at this please and let me know where I've gone wrong?

Many thanks and kind regards

Chris

1 Solution

sdchakraborty
Contributor

Hi,

If I understand your question correctly you need to set the time picker earliest and latest value based on field value right? Can you please have a look at the below code snippet and see whether its satisfying your requirement?

<form>
  <label>demo</label>
  <search id="base_search">
    <query>
     | makeresults
| eval Epoch_STime=strptime("02/26/2019","%m/%d/%Y"), Epoch_ETime=strptime("02/28/2019","%m/%d/%Y") 
    </query>
    <done>
      <set token="form.time.earliest">$result.Epoch_STime$</set>
      <set token="form.time.latest">$result.Epoch_ETime$</set>
    </done>
  </search>
  <fieldset submitButton="false">
    <input type="time" token="time">
      <label>Time</label>
      <default>
        <earliest>0</earliest>
        <latest>now</latest>
      </default>
    </input>
  </fieldset>
</form>

View solution in original post

Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

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

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...