Dashboards & Visualizations

Dropdown variables

DTERM
Contributor

Let's say I have the following query:

index=myapp supportgroup=$supportgroup$ | top productName

where some value will be substituted for $supportgroup$, for example helpdesk, or HR, etc...

I need help populating the searchTemplate and populatingSearch tags for a dropdown I'm working on. I only need help with those two lines. The rest of the dropdown works fine.

Here's what I have.

<searchTemplate>index=myapp supportGroup=$supportGroup$ | top productName </searchTemplate>

<populatingSearch fieldForValue="supportGroup" fieldForLabel="supportGroup"><![CDATA[index=myapp supportGroup | top productName ]]></populatingSearch>

Those lines are not producing the desired output based on my search above. Please help. Thanks in advance.

Tags (1)
0 Karma
1 Solution

sideview
SplunkTrust
SplunkTrust

well with that <populatingSearch> you're telling it to run

index=myapp supportGroup | top productName

and then in those search results, look for a 'supportGroup' field. But there wont be a supportGroup field there.

Also, note that top by default will only return the top 10 values.

You probably want

index=myapp supportGroup | stats count by supportGroup

or

index=myapp supportGroup | top 100 supportGroup

View solution in original post

sideview
SplunkTrust
SplunkTrust

well with that <populatingSearch> you're telling it to run

index=myapp supportGroup | top productName

and then in those search results, look for a 'supportGroup' field. But there wont be a supportGroup field there.

Also, note that top by default will only return the top 10 values.

You probably want

index=myapp supportGroup | stats count by supportGroup

or

index=myapp supportGroup | top 100 supportGroup
Get Updates on the Splunk Community!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...