Dashboards & Visualizations

Pass Time input value as default to another time input

santosh_sshanbh
Path Finder

I have 2 Time inputs on a single dashboard. MY requirement is to pass the value selected for 1st Time input as a default value for 2nd Time input. I tried to use $First_Time.earliest$ for the earliest parameter of 2nd time input but nothing is working for me.

Is there any way to achieve this?

0 Karma

santosh_sshanbh
Path Finder

skoelpin
SplunkTrust
SplunkTrust

Pass the token inline of the search like this

index=... earliest=$First_Time.earliest$ latest=$First_Time.earliest$
0 Karma

santosh_sshanbh
Path Finder

Basically I have a dril down functionality on my dashboard. The first Time input will be visible at load. And 2nd will be visible on drill down. And the default value for 2nd Time input I want to pass the current selected value for 1st Time input.

The drill down search is tied to earliest and latest time range of 2nd Time input.

0 Karma

dmarling
Builder

The below xml will accomplish this on initial page load, but after that it's all bets are off. I don't really understand why you need to do this but it will work:

<form>
  <label>Double Time inputs</label>
  <fieldset submitButton="false">
    <input type="time" token="timetok1">
      <label>time input 1</label>
      <default>
        <earliest>-7d@w0</earliest>
        <latest>@w0</latest>
      </default>
    </input>
    <input type="time" token="timetok2">
      <label></label>
      <default>
        <earliest>$timetok1.earliest$</earliest>
        <latest>$timetok1.latest$</latest>
      </default>
    </input>
  </fieldset>
</form>

On page load it will default the second time input with whatever is in the first time input as long as you don't have the second token timetok2 in the url. If you change the first time input after that point or if you have the timetok2 defined in the url as anything other than form.timetok2.earliest=%24timetok1.earliest%24&form.timetok2.latest=%24timetok1.latest%24, it will ignore whatever is in the first time field.

If this comment/answer was helpful, please up vote it. Thank you.
0 Karma

santosh_sshanbh
Path Finder

This approach I have tried and its not working. I have extended your code by adding a panel to show count of events by sourcetypes. However, I am getting error ' Invalid earliest_time.' at load as well as when date time changes in input 1.

Double Time inputs

<input type="time" token="timetok1">
  <label>time input 1</label>
  <default>
    <earliest>-7d@w0</earliest>
    <latest>@w0</latest>
  </default>
</input>
<input type="time" token="timetok2">
  <label>time input 2</label>
  <default>
    <earliest>$timetok1.earliest$</earliest>
    <latest>$timetok1.latest$</latest>
  </default>
</input>


<panel>
  <table>
    <search>
      <query>index=* | stats count(8) by sourcetype</query>
      <earliest>$timetok2.earliest$</earliest>
      <latest>$timetok2.latest$</latest>
    </search>
    <option name="drilldown">none</option>
    <option name="refresh.display">progressbar</option>
  </table>
</panel>
0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Index This | What travels the world but is also stuck in place?

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

Discover New Use Cases: Unlock Greater Value from Your Existing Splunk Data

Realizing the full potential of your Splunk investment requires more than just understanding current usage; it ...

Continue Your Journey: Join Session 2 of the Data Management and Federation Bootcamp ...

As data volumes continue to grow and environments become more distributed, managing and optimizing data ...