Dashboards & Visualizations

Populating dropdown error : Could not create search

Naren26
Path Finder

I am trying to populate values to a dropdown using the search query. Following is the code:

<input type="dropdown" token="sub_tok" searchWhenChanged="true">
      <label>Subdivisions List</label>
      <choice value="*">All</choice>
      <default>*</default>
      <fieldForLabel>subdivision</fieldForLabel>
      <fieldForValue>subdivision</fieldForValue>
      <search>
        <query>`mymainlog` | rex field=_raw max_match=100 "<(<subdivision>\d{4})," | stats values(subdivision) as subDivs | mvexpand subDivs | rename subDivs as SubDivisionList </query>
        <earliest>-15m</earliest>
    <latest>now</latest>
      </search>
      <delimiter> </delimiter>
    </input>

But I am getting this error Could not create search. But this query is running perfectly fine when executing it as a new search. I am getting almost 40 rows in the search results. But none is getting populated to the dropdown. I had even tried adding head 5, in order to limit the number of rows, but of no luck.

I am using Splunk version 6.5.4

Please help me out.

micahkemp
Champion

Your search query returns a field SubDivisionList but your input is set to use the field subdivision. Your input is looking for a field that doesn't exist so it has no values to display.

niketn
Legend

@Naren26, can you try escaping the angular brackets < and > with &lt;and &gt; in you search query for the drop down?

Alternatively, you can save your working query as a dashboard panel and then copy paste to the input search query. Please try out and confirm.

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

Naren26
Path Finder

This has done the trick. Thanks

0 Karma

niketn
Legend

@Naren26, I have converted to answer. Please accept to mark this as answered.

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Introduction to Splunk AI

How are you using AI in Splunk? Whether you see AI as a threat or opportunity, AI is here to stay. Lucky for ...

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

Maximizing the Value of Splunk ES 8.x

Splunk Enterprise Security (ES) continues to be a leader in the Gartner Magic Quadrant, reflecting its pivotal ...