Dashboards & Visualizations

Why is selectFirstChoice not updating the value selection in the UI?

bcronrath
Path Finder

I have a set of around 5 dropdowns, where each sequential dropdown is populated by values that depend on the dropdown before it. I am using selectFirstChoice set to true in order to update them as values are reselected, and what I am noticing is this:

Let's say I have dropdown "A" and dropdown "B". "B" has a set of values that pull a search using the value selected in "A". Let's say I have "A" set to a value of "male" which allows a bunch of male names, and "B" is set to some arbitrary male name like "John". Let's also say I have graphs below populating based off this selection data, and it's giving me the proper "John" data.

Now, let's say I make a selection to "A" and change it to be "female". Now what happens is that I notice the graphs will repopulate with new data specific to whoever the first selection would be for the female names, let's say "Sally". But visually, the dropdown for "B" is still selected to "John". It isn't until I click on it that I see the male choices are no longer available and only female choices are there - even though the data for B clearly already had changed to a choice within that list, yet visually never moved away from John.

My goal here is to have the "B" dropdown visually change to Sally when the selection on "A" is changed, especially since the data is already clearly selecting the value - so that I can both eliminate any confusion at the data being displayed, and just have a more smooth user experience. Anyone know what extra I need to be doing here in addition to selectFirstChoice set to true?

0 Karma

rjthibod
Champion

I think I had this happen to me too, and the trick to fix it was to force the subsequent inputs to reset their values when the preceding input changed.

For example, you would add a <change> to dropdown "A", and on any condition that "A" changes, I would unset the form token for dropdown "B".

This was by no means the cleanest solution in terms of efficiency of searches, but I do think it fixed this issue.

So, it would look like this

      <input type="dropdown" token="inputA" searchWhenChanged="true">
        ...
        <selectFirstChoice>true</selectFirstChoice>
        <change>
          <condition label="*">
            <unset token="form.inputB"/>
          </condition>
        </change>
      </input>
     <input type="dropdown" token="inputB" searchWhenChanged="true">
        ...
        <search><query> ....something $inputA$ ....| ... </query</search>
        <selectFirstChoice>true</selectFirstChoice>
        <change>
          <condition label="*">
            <unset token="form.inputC"/>
          </condition>
        </change>
      </input>

      .... and so on

somesoni2
Revered Legend

Which version of Splunk are you using?

0 Karma

bcronrath
Path Finder

We are currently on 6.4.0

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