Splunk Search

Why does Dropdown retain entries from old query result?

jonvijay1993
Explorer

I have a query for for my dropdown with tokens inserted here and there and whenever the values on those tokens change my query runs to populate the dropdown.

But the problem is that sometimes the new values and old values are displayed together and I don't want that.

And worse is, the old value remains selected sometimes. I have to manually select my new entry. I have SelectFirstValue to true.

 

 

Labels (4)
0 Karma

jonvijay1993
Explorer

Do you know how I can set the dropdown to the first result in the query, like if the query returns a list of strings, how do I get the first element and set it to the form.token?

 

<unset token="form.project_name"></unset>
<set token="form.project_name">$form.result blah blah$</set>

 

btw the unset method worked, my old results are gone

 

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Since you are trying to set the value of the token, there is no need to also unset it.

<eval token="form.project_name">$results.label</eval>

or whatever the field you are using for the label is called

0 Karma

jonvijay1993
Explorer

Ok I shall try this, thank you! I thought splunk was able to handle this by default, but solutions are also good!

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Try adding a done handler to the search that populates to dropdown which unsets the token.

0 Karma
Get Updates on the Splunk Community!

Splunk + ThousandEyes: Correlate frontend, app, and network data to troubleshoot ...

 Are you tired of troubleshooting delays caused by siloed frontend, application, and network data? We've got a ...

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...

🔐 Trust at Every Hop: How mTLS in Splunk Enterprise 10.0 Makes Security Simpler

From Idea to Implementation: Why Splunk Built mTLS into Splunk Enterprise 10.0  mTLS wasn’t just a checkbox ...