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!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...