Splunk Search

How to generate a search to show columns in a table based on dropdown values

splunklakshman
Explorer

In a dropdown say there are two values : 1) Apple 2) Banana

Underneath table the data has to come like below , while i select Apple from dropdown (token set already) the data should come like

SID,Apples
1,10
2,20
3,30

while i select Banana from dropdown the data should come like

SID,Apples
4,50
8,20
4,9

Kindly

0 Karma

lguinn2
Legend

Try this simple XML

<fieldset>
  <input type="dropdown" token="column_tok">
      <label>Choose column to display</label>
      <choice value="Apples">Apples</choice>
      <choice value="Bananas">Bananas</choice>
      <default>Apples</default>
      <search>
        <query>yoursearchhere | table SID $column_tok|s$
        <earliest>-7d@h</earliest>
        <latest>now</latest>
      </search>
    </input>
</fieldset>
0 Karma

cmerriman
Super Champion

you've opened the same question twice. can you close one? 🙂
https://answers.splunk.com/answers/511492/show-columns-based-on-the-drop-down-values.html

niketn
Legend

@splunklakshman also there is a correction required in second table example. I think it should be SID, Bananas not Apples.

Can you please confirm whether Apples and Bananas are Field Names or Field Values. If they are values, what is the field name? In any case you can refer to "Define tokens for form inputs" on Splunk documentation: http://docs.splunk.com/Documentation/Splunk/6.5.2/Viz/tokens

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma
Get Updates on the Splunk Community!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...