Splunk Search

When first input dropdown value changes run a query using it and set second drop down. How to do it?

cshahfis
Engager

Here first drop down Dates will display last 7 days of date. When user select any one date, query will be executed and that date will be used in query. Results of that query will be displayed in second query. I have tried below mentioned code but it's not throwing any error but my second drop down doesn't populate with correct values. Any pointers you provide will be helpful. Thanks.

 

<input type="dropdown" token="Dates" searchWhenChanged="true">
    <label>Date</label>
    <fieldForLabel>Dates</fieldForLabel>
    <fieldForValue>Dates</fieldForValue>
    <search>
        <query>| gentimes start=-6 end=+1
            | eval Dates=strftime(starttime,"%Y-%m-%d")
            | table Dates
        </query>
        <earliest>-15m</earliest>
        <latest>now</latest>
    </search>
    <default>2020-06-15</default>
    <initialValue>2020-06-15</initialValue>
    <change>
        <set token="form.name">
            <search>
            <query>index= test|rename body.recordTotals{}.from.* as from*|rename header.eventCode as eventCode|where eventCode = "abc" and fromfromUs="true" and messagingCalendarDate="$Dates$"|stats
                count by fromendPointName|table fromendPointName
            </query>
            <search>
        </set>
    </change>
</input>
<input type="dropdown" token="name" searchWhenChanged="true">
<label>Name</label>
<fieldForLabel>name</fieldForLabel>
<fieldForValue>name</fieldForValue>
<choice value="All">All</choice>
<default>All</default>
<initialValue>All</initialValue>
</input>

 

 

 

 

Labels (1)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust

The first dropdown change should set a token value. The second dropdown choices should be populated using the query with the token value selected in the first dropdown.

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust

The first dropdown change should set a token value. The second dropdown choices should be populated using the query with the token value selected in the first dropdown.

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!

Monitoring AI Agents with Splunk Observability Cloud

Let’s say I’m running a travel planning AI app in production. A user asks for three concise hotel options in ...

[Puzzles] Solve, Learn, Repeat: Tiling

This puzzle (first published here) is based on finding groups of tessellated tiles (inspired by floor tiles I ...

SOK it to Me: Top 3 Benefits of Using Splunk Operator on Kubernetes that’ll Make ...

    Thursday, July 9, 2026  |  11:00AM–12:00PM PDT Duration: 1 hour (includes Q&A) Managing can feel like a ...