Dashboards & Visualizations

Dynamically populating dropdown and receving the error "duplicate labels causing conflict"

andreafebbo
Communicator

Hi

<input type="dropdown" token="c" searchWhenChanged="true">
      <label>Cube</label>
      <search>
        <query>BASE SEARCH  | stats count by DatabaseName</query>
        <earliest>@w0</earliest>
        <latest>now</latest>
      </search>
      <fieldForLabel>clabel</fieldForLabel>
      <fieldForValue>cvalue</fieldForValue>
      <choice value="*">All</choice>
      <default>*</default>
      <initialValue>*</initialValue>
    </input>

I have this code for dynamically populating my dropdown but I'm still getting the error

duplicate labels causing conflict

I checked 100 times on but using stats count by DatabaseName should be the correct way.

Any idea on why I'm getting this error?

Thanks

gcusello
SplunkTrust
SplunkTrust

Try to insert
| fields DatabaseName
at the end of your search or something like this
BASE SEARCH | eval DatabaseName=upper(DatabaseName) | dedup DatabaseName | sort DatabaseName | table DatabaseName

Bye.
Giuseppe

0 Karma

andreafebbo
Communicator

I discovered that the error depended by field for value and for label.
If I changefrom this:
clabel
<fieldForValue>cvalue</fieldForValue>

to this:

<fieldForLabel>DatabaseName</fieldForLabel>
        <fieldForValue>DatabaseName</fieldForValue>

It works and I don't know why.

I thought that the 2 fields have to be that same, but if I chenge like this:

<fieldForLabel>DatabaseNameeeeeee</fieldForLabel>
        <fieldForValue>DatabaseName</fieldForValue>

it works, but like this:

<fieldForLabel>bla</fieldForLabel>
            <fieldForValue>bla</fieldForValue>

It does not work.
Can you tell me why?

0 Karma

andreafebbo
Communicator

Same error 😞

0 Karma

s2_splunk
Splunk Employee
Splunk Employee

Hint: Better to use fields instead of table at the end of this search. table does a lot of work for UI formatting, which is not needed anywhere you don't want to render a table.

0 Karma

sundareshr
Legend

Try this

 <input type="dropdown" token="c" searchWhenChanged="true">
       <label>Cube</label>
       <search>
         <query>BASE SEARCH  | eval DatabaseName=upper(DatabaseName) | stats count by DatabaseName</query>
         <earliest>@w0</earliest>
         <latest>now</latest>
       </search>
       <fieldForLabel>DatabaseName</fieldForLabel>
       <fieldForValue>DatabaseName</fieldForValue>
       <choice value="*">All</choice>
       <default>*</default>
       <initialValue>*</initialValue>
     </input>

andreafebbo
Communicator

Same error, as the query I first posted, if run a simple search everything works.
When i put the search in the dropdown I get that error. 😞

0 Karma

sundareshr
Legend

Try removing the static value (All). See if that makes a difference

0 Karma

andreafebbo
Communicator

No difference

0 Karma

sundareshr
Legend

And you confirmed when you run this search outside of dropdown, you get unique list of DatabaseName? Can you share your BASE SEARCH

0 Karma

andreafebbo
Communicator

My base search is like this: i cannot share more:

index=something sourcetype=somthing_else

Yes, I can confirm that the names are unique.

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