Dashboards & Visualizations

How to Pass multiple values with each choice using a dropdown?

adamantium7706
Explorer

I am trying to pass multiple values using a dropdown input. How can I add multiple values with each choice in a dropdown input? As the user clicks any choice, all the values associated with the choice should be passed and populate a panel based on the values.

 

 

<form>
  <label>Demo</label>
  <fieldset submitButton="false">
    <input type="dropdown" token="Variety_token" searchWhenChanged="true">
      <label>Fruit List</label>
      <choice value="111,222,333,444">Mango</choice>
      <choice value="123,456,112">Apple</choice>
      <choice value="555,666,777,888,999">Banana</choice>
      <choice value="753,482">Grapes</choice>
    </input>
  </fieldset>
  <row>
    <panel>
      <table>
        <title>Fruit List/title>
        <search>
          <query>index=* sourcetype=source Fruitid=$Variety_token$ 
| stats count by Fruitname, Fruitvariety, Fruitid......</query>
          <earliest>-1y@y</earliest>
          <latest>@y</latest>
        </search>
        <option name="drilldown">none</option>
        <option name="refresh.display">progressbar</option>
      </table>
    </panel>
  </row>
</form>

 

 

 

Labels (2)
0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

@adamantium7706 

Can you please try Variety_token IN ($Variety_token$) in your panel search. I think it should work.

Example XML:

 

<dashboard version="1.1">

  <label>Demo</label>
  <fieldset submitButton="false">
    <input type="dropdown" token="Variety_token" searchWhenChanged="true">
      <label>Fruit List</label>
      <choice value="111,222,333,444">Mango</choice>
      <choice value="123,456,112">Apple</choice>
      <choice value="555,666,777,888,999">Banana</choice>
      <choice value="753,482">Grapes</choice>
    </input>
  </fieldset>
  <row>
    <panel>
      <table>
        <title>Fruit List</title>
        <search>
          <query>| makeresults 
| eval Variety_token=split("111,222,333,444,123,456,112,555,666,777,888,999,753,482",",") 
| rename comment as "Up to now is for sample data only" 
| stats c by Variety_token | search Variety_token IN ($Variety_token$) </query>
          <earliest>-1y@y</earliest>
          <latest>@y</latest>
        </search>
        <option name="drilldown">none</option>
        <option name="refresh.display">progressbar</option>
      </table>
    </panel>
  </row>
</dashboard>

 

Thanks
KV
If any of my replies help you to solve the problem Or gain knowledge, an upvote would be appreciated.

0 Karma
Get Updates on the Splunk Community!

Introducing Value Insights (Beta): Understand the Business Impact your organization ...

Real progress on your strategic priorities starts with knowing the business outcomes your teams are delivering ...

Enterprise Security (ES) Essentials 8.3 is Now GA — Smarter Detections, Faster ...

As of today, Enterprise Security (ES) Essentials 8.3 is now generally available, helping SOC teams simplify ...

Unlock Instant Security Insights from Amazon S3 with Splunk Cloud — Try Federated ...

Availability: Must be on Splunk Cloud Platform version 10.1.2507.x to view the free trial banner. If you are ...