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!

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, ...