Dashboards & Visualizations

database field value in dropdown

vikas_gopal
Builder

Hi Guys,

I have a DBquery "select distinct open_date from ABC" .I want to show these dates in dropdown list .Please suggest how to do it..

Regards
Vikas

Tags (1)
0 Karma
1 Solution

vikas_gopal
Builder

Finally I crack this and i did not believe it was just a silly mistake. I just mentioned field name in "" in the dbquery which is "opendate".So keep this in mind whatever you are mentioning in the fieldforvalue and fieldforlable should be similar to ur field name in dbquery that is it.
here is my code


<!-- Define a simple dropdown form driven by a search -->



<![CDATA[| dbquery "Finance Database" "select distinct open_date "opendate" from ABC" ]]>


View solution in original post

vikas_gopal
Builder

I found another solution for this . Using Lookup you can achieve the same.
follow the following steps
1) Create a csv file in the following location "Splunk home\etc\apps\dbx\lookups lets say the file is "user.csv".Make sure u must have some data in the CSV file.Else if u chk my code I am creating a CSV from dbquery with the help of | outputlookup command.
2) Create a new lookup from Settings--->Lookups-->Lookup table file here select the same csv file which u have created u can choose the same file name in the destination lets say the name is "vikaslookup".
3) Make sure u chkd the permissions it should be global.
4) Now open splunk and type the following code and that is it.

| dbquery "your database" "select abcdate as "Fromdate" from help"| outputlookup user.csv




<![CDATA[ | inputlookup vikaslookup ]]>

2013

0 Karma

vikas_gopal
Builder

Finally I crack this and i did not believe it was just a silly mistake. I just mentioned field name in "" in the dbquery which is "opendate".So keep this in mind whatever you are mentioning in the fieldforvalue and fieldforlable should be similar to ur field name in dbquery that is it.
here is my code


<!-- Define a simple dropdown form driven by a search -->



<![CDATA[| dbquery "Finance Database" "select distinct open_date "opendate" from ABC" ]]>


vikas_gopal
Builder

Thanks Theouhuios

Actually I am preparing a dashboard which takes input from oracle database and I want to show date field in dropdown, user will select one date from the dropdown list and on the basis of that dashboard table shows data.

0 Karma

somesoni2
Revered Legend

See Splunk documentation for how a search can be used to populate dropdown.
Splunk 6.x - http://docs.splunk.com/Documentation/Splunk/latest/Viz/PanelreferenceforSimplifiedXML#dropdown

theouhuios
Motivator

Where do you want to show these dates? In a dashboard? You will have to pull the data in first to be able to do that. Please add some more information on what you plan to do.

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