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
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Character substitutions with Regular Expressions

This challenge was first posted on Slack #puzzles channelFor BORE at .conf23, we had a puzzle question which ...

Splunk Community Badges!

  Hey everyone! Ready to earn some serious bragging rights in the community? Along with our existing badges ...

[Puzzles] Solve, Learn, Repeat: Matching cron expressions

This puzzle (first published here) is based on matching timestamps to cron expressions.All the timestamps ...