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!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...