Dashboards & Visualizations

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

IRHM73
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
1 Solution

vincenteous
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

afishkin_splunk
Splunk Employee
Splunk Employee

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

IRHM73
Motivator

Hi @afishkin, thank you very much for this.

Many thanks and kind regards

Chris

0 Karma

vincenteous
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>

IRHM73
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

aholzel
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

IRHM73
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
Get Updates on the Splunk Community!

Splunk is Nurturing Tomorrow’s Cybersecurity Leaders Today

Meet Carol Wright. She leads the Splunk Academic Alliance program at Splunk. The Splunk Academic Alliance ...

Part 2: A Guide to Maximizing Splunk IT Service Intelligence

Welcome to the second segment of our guide. In Part 1, we covered the essentials of getting started with ITSI ...

Part 1: A Guide to Maximizing Splunk IT Service Intelligence

As modern IT environments continue to grow in complexity and speed, the ability to efficiently manage and ...