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!

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...