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!

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