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!

Splunk Answers Content Calendar, June Edition

Get ready for this week’s post dedicated to Splunk Dashboards! We're celebrating the power of community by ...

What You Read The Most: Splunk Lantern’s Most Popular Articles!

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

See your relevant APM services, dashboards, and alerts in one place with the updated ...

As a Splunk Observability user, you have a lot of data you have to manage, prioritize, and troubleshoot on a ...