Dashboards & Visualizations
Highlighted

How to populate a drop-down menu via selected values from a timepicker?

Motivator

Hi,

I wonder whether someone could help me please.

I have a dashboard which has 'Timepicker' and 'Dropdown Menu' panels as shown below.

<form>
      <label>Cascading Multiple Dropdown inc. Time - Working Clone</label>
      <description>A form input element's selected value is used to populate another form input element's options.</description>
      <fieldset autoRun="true">
        <input type="time" token="dashboardTime">
          <label>Select a Time Range</label>
          <default>
            <earliest>@d</earliest>
            <latest>now</latest>
          </default>
        </input>
        <input type="dropdown" token="username">
          <label>Select a Form</label>
          <default>*</default>
          <choice value="*">All</choice>
          <search>
            <query>detail.utr="*" | stats count by detail.formId</query>
          </search>
          <earliestTime>$dashboardTime.earliest$</earliestTime>
          <latestTime>$dashboardTime.latest$</latestTime>
          <fieldForLabel>detail.formId</fieldForLabel>
          <fieldForValue>detail.formId</fieldForValue>
        </input>
      </fieldset>
    </form>

The problem I have is that I'm trying to link the Time Picker to the drop-down menu, so the values in the drop-down menu will depend on the time range selected.

I've been working on this for some time now, but I can't get this to work.

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

Many thanks and kind Regards

Chris

0 Karma
Highlighted

Re: How to populate a drop-down menu via selected values from a timepicker?

Communicator

I think the problem is in line 19 and 20
You used:

<earliestTime>$dashboardTime.earliest$</earliestTime>
<latestTime>$dashboardTime.latest$</latestTime>

It needs to be:

<earliest>$dashboardTime.earliest$</earliest>
<latest>$dashboardTime.latest$</latest>
0 Karma
Highlighted

Re: How to populate a drop-down menu via selected values from a timepicker?

Motivator

Hi, thank you for coming back to me with this.

I've made the changes as you suggest, but unfortunately this doesn't work because the dropdown menu doesn't re-populate when the date changes.

Many thanks and kind regards

Chris

0 Karma
Highlighted

Re: How to populate a drop-down menu via selected values from a timepicker?

Communicator

Hi IRHM73,

How about you put the "earliest" & "latest" tokens in your search query? Something like this:

<query>detail.utr="*" earliest=$dashboardTime.earliest$ latest=$dashboardTime.latest$ | stats count by detail.formId</query>

View solution in original post

Highlighted

Re: How to populate a drop-down menu via selected values from a timepicker?

Motivator

Hi @vincenteous, thank you for taking the time to reply to my post. This works great.

Many thanks and kind regards

Chris

0 Karma
Highlighted

Re: How to populate a drop-down menu via selected values from a timepicker?

Path Finder

Please try
<search>
Your query
$form.earliest$
$fort.latest

Highlighted

Re: How to populate a drop-down menu via selected values from a timepicker?

Motivator

Hi @afishkin, thank you very much for this.

Many thanks and kind regards

Chris

0 Karma
Speak Up for Splunk Careers!

We want to better understand the impact Splunk experience and expertise has has on individuals' careers, and help highlight the growing demand for Splunk skills.